diff --git a/install.sh b/install.sh index bf55b99..d565f66 100644 --- a/install.sh +++ b/install.sh @@ -24,7 +24,8 @@ fi cat > /home/${userland_name}/.config/systemd/user/presentation.service << EOF [Unit] -Description="Systemec Akarton Raspberry Pi Uploader Program (SARPUS)" +Description="Systemec RaspScreen" +Conflicts=video.service After=graphical.target [Service] @@ -44,7 +45,8 @@ EOF cat > /home/${userland_name}/.config/systemd/user/video.service << EOF [Unit] -Description="Systemec Akarton Raspberry Pi Uploader Program (SARPUS)" +Description="Systemec RaspScreen" +Conflicts=presentation.service After=graphical.target [Service] diff --git a/manage.sh b/manage.sh new file mode 100644 index 0000000..0be8dd0 --- /dev/null +++ b/manage.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Utility to manage the userland program called RaspScreen by Systemec B.V. +# +# Where it should live: /opt/raspscreen/bin/manage.sh +# +# Examples: +# ./manage.sh (restart|stop|start) (presentation|video) + +runtime_id=$(id -u) +if [[ "$runtime_id" -eq 0 ]]; then + echo "Do not run as root. Run as the graphical user." +fi \ No newline at end of file diff --git a/service-files/presentation.service b/service-files/presentation.service index 1e9d628..196db8e 100644 --- a/service-files/presentation.service +++ b/service-files/presentation.service @@ -1,5 +1,6 @@ [Unit] Description="Systemec RaspScreen" +Conflicts=video.service After=graphical.target [Service] diff --git a/service-files/video.service b/service-files/video.service index 558b094..cb4051c 100644 --- a/service-files/video.service +++ b/service-files/video.service @@ -1,5 +1,6 @@ [Unit] Description="Systemec RaspScreen" +Conflicts=presentation.service After=graphical.target [Service] diff --git a/src/action.go b/src/action.go index 74b483b..f00f9df 100644 --- a/src/action.go +++ b/src/action.go @@ -116,11 +116,11 @@ func sftpUploadFile(targetName, localPath, remotePath string, cfg RaspiConfig) b func restartShow(targetName string, targetMode int, cfg RaspiConfig) bool { const restartPresentation string = "systemctl --user restart presentation" const enablePresentation string = "systemctl --user enable presentation" - const disablePresentation string = "systemctl --user disable --now presentation" + const disablePresentation string = "systemctl --user disable presentation" const restartVideo string = "systemctl --user restart video" const enableVideo string = "systemctl --user enable video" - const disableVideo string = "systemctl --user disable --now video" + const disableVideo string = "systemctl --user disable video" var err error sshClient, err := createSSHClient(targetName, cfg) @@ -141,13 +141,13 @@ func restartShow(targetName string, targetMode int, cfg RaspiConfig) bool { switch targetMode { case 1: log.Println("Configuring application workflow: Presentation") - _, err = runSSHCommand(sshClient, restartPresentation) _, err = runSSHCommand(sshClient, disableVideo) + _, err = runSSHCommand(sshClient, restartPresentation) _, err = runSSHCommand(sshClient, enablePresentation) case 2: log.Println("Configuring application workflow: Video") - _, err = runSSHCommand(sshClient, restartVideo) _, err = runSSHCommand(sshClient, disablePresentation) + _, err = runSSHCommand(sshClient, restartVideo) _, err = runSSHCommand(sshClient, enableVideo) }