chore: add begin of manage script and modify service file for systemd conflict
This commit is contained in:
@@ -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]
|
||||
|
||||
13
manage.sh
Normal file
13
manage.sh
Normal file
@@ -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
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
Conflicts=video.service
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
Conflicts=presentation.service
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user