Added GPIO Shutdown install and user Input for GPIO Startup and SystemD Services
This commit is contained in:
@@ -8,10 +8,24 @@ NOCOLOR='\033[0m'
|
|||||||
|
|
||||||
echo -e "${GREEN}======== Starte Installation =========${NOCOLOR}"
|
echo -e "${GREEN}======== Starte Installation =========${NOCOLOR}"
|
||||||
|
|
||||||
echo -e "${CYAN_BACK} Would you like to enable the System D service for atomatic start of video planback?"
|
read -p "Do you want to add a SystemD Servide for Autostart [y|n]" INPUT
|
||||||
read USERSELECT -p "(Y/N)"
|
SYSD=1
|
||||||
echo -e "${NOCOLOR}"
|
|
||||||
|
|
||||||
|
case $INPUT in
|
||||||
|
y|Y) SYSD=0 ;;
|
||||||
|
n|N) SYSD=1 ;;
|
||||||
|
*) echo "SystemD Service will not be Added...." ;;
|
||||||
|
esac
|
||||||
|
INPUT=""
|
||||||
|
|
||||||
|
read -p "Do you want to add GPIO Power Controle [y|n]" INPUT
|
||||||
|
GPPower=1
|
||||||
|
|
||||||
|
case $INPUT in
|
||||||
|
y|Y) GPPower=0 ;;
|
||||||
|
n|N) GPPower=1 ;;
|
||||||
|
*) echo "GPIO Power controll will not be Addaded.........." ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
CURRENT_USER=$(whoami)
|
CURRENT_USER=$(whoami)
|
||||||
@@ -52,6 +66,15 @@ cd ..
|
|||||||
|
|
||||||
echo -e "${GREEN}======== Erestele Systemd Service ========${NOCOLOR}"
|
echo -e "${GREEN}======== Erestele Systemd Service ========${NOCOLOR}"
|
||||||
|
|
||||||
|
AUTOLOGIN_SERVICE_CONTENT="[Service]
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=-/sbin/agetty --autologin $CURRENT_USER --noclear tty1 linux
|
||||||
|
"
|
||||||
|
|
||||||
|
# Erstelle die Autologin-Service-Datei
|
||||||
|
echo "Erstelle die Autologin-Service-Datei unter /etc/systemd/system/getty@tty1.service.d/override.conf..."
|
||||||
|
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d/
|
||||||
|
|
||||||
SERVICE_CONTENT="[Unit]
|
SERVICE_CONTENT="[Unit]
|
||||||
Description=Video Control Script
|
Description=Video Control Script
|
||||||
After=network.target
|
After=network.target
|
||||||
@@ -68,6 +91,9 @@ User=$CURRENT_USER
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
echo "$AUTOLOGIN_SERVICE_CONTENT" | sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null
|
||||||
|
|
||||||
# Erstelle der PiVideo Service-Datei
|
# Erstelle der PiVideo Service-Datei
|
||||||
echo "$SERVICE_CONTENT" | sudo tee /etc/systemd/system/$SERVICE_NAME > /dev/null
|
echo "$SERVICE_CONTENT" | sudo tee /etc/systemd/system/$SERVICE_NAME > /dev/null
|
||||||
|
|
||||||
@@ -75,7 +101,7 @@ echo "$SERVICE_CONTENT" | sudo tee /etc/systemd/system/$SERVICE_NAME > /dev/null
|
|||||||
echo -e "${GREEN}======== Lade Dienste neu ========${NOCOLOR}"
|
echo -e "${GREEN}======== Lade Dienste neu ========${NOCOLOR}"
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
if ["$USRSELECT" == "Y" ] || ["$USERSELECT" == "y"]
|
if [ $SYSD -eq 0 ]
|
||||||
then
|
then
|
||||||
USERSELECT=""
|
USERSELECT=""
|
||||||
# Aktiviere den Service, damit er beim Booten gestartet wird
|
# Aktiviere den Service, damit er beim Booten gestartet wird
|
||||||
@@ -93,6 +119,12 @@ else
|
|||||||
echo -e "${CYAN_BACK} Did not start Service, to start use \"sudo systemctl start pivideo.service\" ${NOCOLOR}"
|
echo -e "${CYAN_BACK} Did not start Service, to start use \"sudo systemctl start pivideo.service\" ${NOCOLOR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $GPPower -eq 0]
|
||||||
|
then
|
||||||
|
echo "dtoverlay=gpio-shutdown,gpio-pin=3" | sudo tee /boot/config.txt > /dev/null
|
||||||
|
else
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}=========================================================${NOCOLOR}"
|
echo -e "${GREEN}=========================================================${NOCOLOR}"
|
||||||
echo -e "${GREEN}======== Das Script wurde Erfolgreich Ausgeführt ========${NOCOLOR}"
|
echo -e "${GREEN}======== Das Script wurde Erfolgreich Ausgeführt ========${NOCOLOR}"
|
||||||
|
|||||||
Reference in New Issue
Block a user