foodoord/debian/DEBIAN/postinst

36 lines
952 B
Plaintext
Raw Normal View History

2022-04-15 16:17:58 +00:00
#!/bin/bash
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 16:49:40 +00:00
for u in close open door; do
groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
2022-04-15 16:17:58 +00:00
done
echo "Chmod foodoor"
chmod 755 /var/lib/foodoor
2022-04-15 16:17:58 +00:00
echo "Create /state"
touch /state
2022-04-15 16:49:40 +00:00
chown root:foodoor /state
2022-04-15 16:17:58 +00:00
chmod 664 /state
echo "##################"
while [ "$prompt" != "oben" -a "$prompt" != "unten" ]; do
read -p "Sind wir oben oder unten? (oben, unten): " prompt
done
echo "##################"
echo "Installing dependencies via pip: pifacecommon pifacedigitalio"
pip install pifacecommon pifacedigitalio
echo "Enabling and starting systemd-Services"
2022-04-15 16:49:40 +00:00
systemctl daemon-reload
systemctl enable foodoord@$prompt
systemctl restart foodoord@$prompt
systemctl status foodoord@$prompt