37 lines
983 B
Plaintext
Raw Normal View History

2022-04-15 18:17:58 +02:00
#!/bin/bash
2024-06-07 22:17:06 +02:00
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
2024-06-07 22:17:06 +02:00
groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
2022-04-15 18:17:58 +02:00
done
echo "Chmod foodoor"
chmod 755 /var/lib/foodoor
2022-04-15 18:17:58 +02:00
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
echo "##################"
2024-06-07 22:17:06 +02: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"
2025-01-10 01:10:31 +01:00
pip install pifacecommon pifacedigitalio paho-mqtt
echo "Enabling and starting systemd-Services"
2022-04-15 18:49:40 +02:00
systemctl daemon-reload
2024-06-07 22:17:06 +02:00
systemctl enable "foodoord@$prompt"
systemctl restart "foodoord@$prompt"
systemctl status "foodoord@$prompt"