23 lines
527 B
Plaintext
Raw Normal View History

2022-04-15 18:17:58 +02:00
#!/bin/bash
2022-04-15 18:49:40 +02:00
set -x
2022-04-15 18:17:58 +02:00
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"
2022-04-15 18:49:40 +02:00
for u in close open door; do
groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
2022-04-15 18:17:58 +02:00
done
echo "Create /state"
touch /state
2022-04-15 18:49:40 +02:00
chown root:foodoor /state
2022-04-15 18:17:58 +02:00
chmod 664 /state
2022-04-15 18:49:40 +02:00
systemctl daemon-reload
systemctl enable foodoord
systemctl restart foodoord