foodoord/debian/DEBIAN/postinst
2022-04-15 18:49:40 +02:00

23 lines
527 B
Bash
Executable File

#!/bin/bash
set -x
echo "Creating group and users.."
groupadd foodoor
useradd -M -d /var/lib/foodoor/close -G foodoor -s /bin/sh close
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
groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
done
echo "Create /state"
touch /state
chown root:foodoor /state
chmod 664 /state
systemctl daemon-reload
systemctl enable foodoord
systemctl restart foodoord