Added experimental userinput for Autostart
This commit is contained in:
@@ -1,10 +1,18 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Definition of colors for text output
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
|
CYAN_BACK='\x1b[46m'
|
||||||
|
|
||||||
NOCOLOR='\033[0m'
|
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 USERSELECT -p "(Y/N)"
|
||||||
|
echo -e "${NOCOLOR}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CURRENT_USER=$(whoami)
|
CURRENT_USER=$(whoami)
|
||||||
SERVICE_NAME="pivideo.service"
|
SERVICE_NAME="pivideo.service"
|
||||||
@@ -44,12 +52,6 @@ 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
|
|
||||||
"
|
|
||||||
|
|
||||||
|
|
||||||
SERVICE_CONTENT="[Unit]
|
SERVICE_CONTENT="[Unit]
|
||||||
Description=Video Control Script
|
Description=Video Control Script
|
||||||
After=network.target
|
After=network.target
|
||||||
@@ -66,13 +68,6 @@ User=$CURRENT_USER
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
"
|
"
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@@ -80,20 +75,23 @@ 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
|
||||||
|
|
||||||
# Aktiviere den Service, damit er beim Booten gestartet wird
|
if ["$USRSELECT" == "Y" ] || ["$USERSELECT" == "y"]
|
||||||
echo -e "${GREEN}======== Aktiviern des Dienstes ========${NOCOLOR}"
|
then
|
||||||
echo "Aktiviere den Autologin-Service..."
|
USERSELECT=""
|
||||||
sudo systemctl enable getty@tty1.service
|
# Aktiviere den Service, damit er beim Booten gestartet wird
|
||||||
|
echo -e "${GREEN}======== Aktiviern des Dienstes ========${NOCOLOR}"
|
||||||
|
|
||||||
echo "Aktivire den PiVideo-Service..."
|
echo "Aktivire den PiVideo-Service..."
|
||||||
sudo systemctl enable $SERVICE_NAME
|
sudo systemctl enable $SERVICE_NAME
|
||||||
|
|
||||||
# Starten des Services
|
|
||||||
echo -e "${GREEN}======== Starente des Dienstes ========${NOCOLOR}"
|
|
||||||
|
|
||||||
sudo systemctl start getty@tty1.service
|
|
||||||
sudo systemctl start $SERVICE_NAME
|
|
||||||
|
|
||||||
|
# Starten des Services
|
||||||
|
echo -e "${GREEN}======== Starente des Dienstes ========${NOCOLOR}"
|
||||||
|
sudo systemctl start $SERVICE_NAME
|
||||||
|
else
|
||||||
|
USERSELECT= ""
|
||||||
|
echo -e "${CYAN_BACK} Automatic start of Playback disabled ${NOCOLOR}"
|
||||||
|
echo -e "${CYAN_BACK} Did not start Service, to start use \"sudo systemctl start pivideo.service\" ${NOCOLOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo -e "${GREEN}=========================================================${NOCOLOR}"
|
echo -e "${GREEN}=========================================================${NOCOLOR}"
|
||||||
|
|||||||
Reference in New Issue
Block a user