--- setup.sh.orig 2016-10-20 22:39:33.000000000 +0200 +++ setup.sh 2016-11-15 01:30:10.986666666 +0100 @@ -738,33 +738,10 @@ create_sudo_configuration () { - # sudo only possible if running as root - if [ $UID != 0 ] ; then - return - fi - + mkdir -p $DESTDIR/etc/sudoers.d sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (root) NOPASSWD: $bindir/check_mk --automation *" - - if [ ! -e /etc/sudoers ] ; then - echo "You do not have sudo installed. Please install sudo " - echo "and add the following line to /etc/sudoers if you want" - echo "to use WATO - the Check_MK Web Administration Tool" - echo - echo -e "$sudolines" - echo - echo - return - fi - - if fgrep -q 'check_mk --automation' /etc/sudoers 2>/dev/null - then - # already present. Do not touch. - return - fi - - echo >> /etc/sudoers - echo "# Needed for WATO - the Check_MK Web Administration Tool" >> /etc/sudoers - echo -e "$sudolines" >> /etc/sudoers + echo "# Needed for WATO - the Check_MK Web Administration Tool" > $DESTDIR/etc/sudoers.d/check_mk + echo -e "$sudolines" >> $DESTDIR/etc/sudoers.d/check_mk } while true @@ -1049,8 +1026,9 @@ # WATO. Also create an empty and Apache-writable auth.serials serials_file=$DESTDIR${htpasswd_file%/*}/auth.serials && touch "$serials_file" && + touch "$DESTDIR${htpasswd_file}" && (chown $wwwuser "$serials_file" || true) && - (chown $wwwuser "$htpasswd_file" || true) && + (chown $wwwuser "$DESTDIR$htpasswd_file" || true) && create_sudo_configuration && if [ "$enable_mkeventd" = yes ] then