diff --git a/debian/DEBIAN/postinst b/debian/DEBIAN/postinst index 70a4945..5676e66 100755 --- a/debian/DEBIAN/postinst +++ b/debian/DEBIAN/postinst @@ -1,4 +1,5 @@ #!/bin/bash +set -x echo "Creating group and users.." groupadd foodoor useradd -M -d /var/lib/foodoor/close -G foodoor -s /bin/sh close @@ -6,12 +7,16 @@ useradd -M -d /var/lib/foodoor/open -G foodoor -s /bin/sh open useradd -M -d /var/lib/foodoor/door -G foodoor -s /bin/sh door echo "Chown homes" -for u in "close open door"; do - chown ${u}:${u} ${u} +for u in close open door; do + groupadd ${u} + chown ${u}:${u} /var/lib/foodoor/${u} done echo "Create /state" touch /state -chgrp root:foodoor /state +chown root:foodoor /state chmod 664 /state +systemctl daemon-reload +systemctl enable foodoord +systemctl restart foodoord diff --git a/debian/etc/init.d/foodoord b/debian/etc/init.d/foodoord index 922798b..dff0905 100755 --- a/debian/etc/init.d/foodoord +++ b/debian/etc/init.d/foodoord @@ -16,7 +16,7 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="foodoor daemon" -WHERE=$(cat /etc/foodoord.conf | grep 'where' | awk -F '=' '{ print $2 }') +WHERE=$(cat /etc/foodoord.conf | grep 'where' | awk -F '=' '{ print $2 }' | tr -d ' ') NAME=foodoord_${WHERE} DAEMON=/usr/sbin/$NAME #DAEMON_ARGS="--options args"