foodoord/debian/DEBIAN/postinst

37 lines
973 B
Plaintext
Raw Permalink Normal View History

2022-04-15 16:17:58 +00:00
#!/bin/bash
2024-06-07 20:17:06 +00:00
2022-04-15 16:17:58 +00: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 16:49:40 +00:00
for u in close open door; do
2024-06-07 20:17:06 +00:00
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 "##################"
2024-06-07 20:17:06 +00:00
while [ "$prompt" != "oben" ] && [ "$prompt" != "unten" ]; do
read -r -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
2024-06-07 20:17:06 +00:00
systemctl enable "foodoord@$prompt"
systemctl restart "foodoord@$prompt"
systemctl status "foodoord@$prompt"