foodoord/debian/DEBIAN/postinst

36 lines
952 B
Bash
Executable File

#!/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"
for u in close open door; do
groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
done
echo "Chmod foodoor"
chmod 755 /var/lib/foodoor
echo "Create /state"
touch /state
chown root:foodoor /state
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"
systemctl daemon-reload
systemctl enable foodoord@$prompt
systemctl restart foodoord@$prompt
systemctl status foodoord@$prompt