summarylogtreecommitdiffstats
path: root/setup.sh.patch
blob: 33402b1eb1072889a4d5651bd823dab8302a4af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- 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