chore: fix go removal issue and make script with configurable user
This commit is contained in:
13
install.sh
13
install.sh
@@ -2,26 +2,24 @@
|
||||
|
||||
program_name="akartontv"
|
||||
runtime_id=$(id -u)
|
||||
userland_name="systemec"
|
||||
userland_name="${1-systemec}"
|
||||
|
||||
# Check if the user is right (root) for the program
|
||||
if [[ "$runtime_id" -ne 0 ]]; then
|
||||
echo "Not running as root, please run as root."
|
||||
exit 1
|
||||
fi
|
||||
apt-get -y install libreoffice-impress ssh vlc
|
||||
apt-get -y install libreoffice-impress psmisc ssh vlc
|
||||
systemctl enable --now ssh
|
||||
|
||||
# Create the systemd userland folder
|
||||
if [[ ! -d /home/${userland_name}/.config/systemd/user ]]; then
|
||||
mkdir -p /home/${userland_name}/.config/systemd/user -m 755
|
||||
chown -R ${userland_name}:${userland_name} /home/${userland_name}/.config/systemd/user
|
||||
fi
|
||||
|
||||
# Create the program place onto /opt
|
||||
if [[ ! -d /opt/${program_name} ]]; then
|
||||
mkdir -p /opt/${program_name}/media -m 755
|
||||
chown -R ${userland_name}:${userland_name} /opt/${program_name}
|
||||
fi
|
||||
|
||||
cat > /home/${userland_name}/.config/systemd/user/presentation.service << EOF
|
||||
@@ -34,7 +32,7 @@ Type=simple
|
||||
Environment=DISPLAY=:0
|
||||
WorkingDirectory=/opt/akartontv
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/akartontv/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore \$(find /opt/akartontv/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
@@ -54,7 +52,7 @@ Type=simple
|
||||
Environment=DISPLAY=:0
|
||||
WorkingDirectory=/opt/akartontv
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/vlc --fullscreen --loop --no-video-title --video-on-top --no-qt-fs-controller --qt-continue=0 $(find /opt/akartontv/media \( -name "*.mp4" -o -name "*.mkv" -o -name "*.mov" -o -name "*.webm" \))'
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/vlc --fullscreen --loop --no-video-title --video-on-top --no-qt-privacy-ask --no-qt-fs-controller --qt-continue=0 \$(find /opt/akartontv/media \( -name "*.mp4" -o -name "*.mkv" -o -name "*.mov" -o -name "*.webm" \))'
|
||||
ExecStop=/usr/bin/killall vlc
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
@@ -64,4 +62,5 @@ RestartSec=2
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
chown ${userland_name}:${userland_name} /home/${userland_name}/.config/systemd -R
|
||||
chown -Rv ${userland_name}:${userland_name} /home/${userland_name}/.config/systemd
|
||||
chown -Rv ${userland_name}:${userland_name} /opt/${program_name}
|
||||
@@ -66,7 +66,7 @@ func verifyCred(targetName string, cfg RaspiConfig) bool {
|
||||
}
|
||||
|
||||
func sftpUploadFile(targetName, localPath, remotePath string, cfg RaspiConfig) bool {
|
||||
const clearDirectory string = "rm /opt/akartontv/*"
|
||||
const clearDirectory string = "rm /opt/akartontv/media/*"
|
||||
|
||||
sshClient, err := createSSHClient(targetName, cfg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user