2015-03-17 10:42:46 +01:00
|
|
|
#!/bin/sh
|
|
|
|
ICINGA2_BIN=@CMAKE_INSTALL_FULL_LIBDIR@/icinga2/sbin/icinga2
|
|
|
|
|
2015-03-17 18:01:48 +01:00
|
|
|
if test "x`uname -s`" = "xLinux" -a "x$1" = "xconsole"; then
|
2015-03-17 10:42:46 +01:00
|
|
|
libedit_line=`ldd $ICINGA2_BIN 2>&1 | grep libedit`
|
|
|
|
if test $? -eq 0; then
|
|
|
|
libedit_path=`echo $libedit_line | cut -f3 -d' '`
|
|
|
|
if test -n "$libedit_path"; then
|
|
|
|
libdir=`dirname -- $libedit_path`
|
2015-03-17 18:01:48 +01:00
|
|
|
found=0
|
|
|
|
for libreadline_path in `ls -1r -- $libdir/libreadline.so.* 2>/dev/null`; do
|
|
|
|
found=1
|
2015-03-17 10:42:46 +01:00
|
|
|
break
|
|
|
|
done
|
2015-03-17 18:01:48 +01:00
|
|
|
if test $found -eq 0; then
|
|
|
|
libdir2=/`echo $libdir | cut -f3- -d/`
|
|
|
|
for libreadline_path in `ls -1r -- $libdir2/libreadline.so.* 2>/dev/null`; do
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
if test $found -gt 0; then
|
2015-03-17 10:42:46 +01:00
|
|
|
export LD_PRELOAD="$libreadline_path:$LD_PRELOAD"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-11-05 12:08:38 +01:00
|
|
|
exec $ICINGA2_BIN "$@"
|