]> granicus.if.org Git - icinga2/blob - icinga-app/icinga2.cmake
Merge pull request #7183 from hlsolutions/bugfix/systemv-returncode
[icinga2] / icinga-app / icinga2.cmake
1 #!/bin/sh
2 ICINGA2_BIN=@CMAKE_INSTALL_FULL_LIBDIR@/icinga2/sbin/icinga2
3
4 if test "x`uname -s`" = "xLinux" -a "x$1" = "xconsole"; then
5   libedit_line=`ldd $ICINGA2_BIN 2>&1 | grep libedit`
6   if test $? -eq 0; then
7     libedit_path=`echo $libedit_line | cut -f3 -d' '`
8     if test -n "$libedit_path"; then
9       libdir=`dirname -- $libedit_path`
10       found=0
11       for libreadline_path in `ls -1r -- $libdir/libreadline.so.* 2>/dev/null`; do
12         found=1
13         break
14       done
15       if test $found -eq 0; then
16         libdir2=/`echo $libdir | cut -f3- -d/`
17         for libreadline_path in `ls -1r -- $libdir2/libreadline.so.* 2>/dev/null`; do
18           found=1
19           break
20         done
21       fi
22       if test $found -gt 0; then
23         export LD_PRELOAD="$libreadline_path:$LD_PRELOAD"
24       fi
25     fi
26   fi
27 fi
28
29 exec $ICINGA2_BIN "$@"