chore: begin work on op_mode
This commit is contained in:
8
install.sh
Normal file → Executable file
8
install.sh
Normal file → Executable file
@@ -22,6 +22,7 @@ if [[ ! -d /opt/${program_name} ]]; then
|
||||
mkdir -p /opt/${program_name}/media -m 755
|
||||
fi
|
||||
|
||||
# THIS MUST BE THE SAME AR $REPO/service-files/presentation.service
|
||||
cat > /home/${userland_name}/.config/systemd/user/presentation.service << EOF
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
@@ -33,16 +34,16 @@ Type=simple
|
||||
Environment=DISPLAY=:0
|
||||
WorkingDirectory=/opt/raspscreen
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore \$(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
# THIS MUST BE THE SAME AR $REPO/service-files/video.service
|
||||
cat > /home/${userland_name}/.config/systemd/user/video.service << EOF
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
@@ -54,10 +55,9 @@ Type=simple
|
||||
Environment=DISPLAY=:0
|
||||
WorkingDirectory=/opt/raspscreen
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
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/raspscreen/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-fs-controller --qt-continue=0 $(find /opt/raspscreen/media \( -name "*.mp4" -o -name "*.mkv" -o -name "*.mov" -o -name "*.webm" \))'
|
||||
ExecStop=/usr/bin/killall vlc
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
49
manage.sh
Normal file → Executable file
49
manage.sh
Normal file → Executable file
@@ -6,8 +6,55 @@
|
||||
#
|
||||
# Examples:
|
||||
# ./manage.sh (restart|stop|start) (presentation|video)
|
||||
#
|
||||
# systemctl must be reachable from the path of the executing user.
|
||||
|
||||
runtime_id=$(id -u)
|
||||
if [[ "$runtime_id" -eq 0 ]]; then
|
||||
echo "Do not run as root. Run as the graphical user."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "Checking input..."
|
||||
case "$1" in
|
||||
restart|stop|start)
|
||||
printf "Valid command...";;
|
||||
*)
|
||||
echo "Invalid command!"
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
case "$2" in
|
||||
presentation|video)
|
||||
echo "Valid service...";;
|
||||
*)
|
||||
echo "Invalid service!"
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
case "$3" in
|
||||
--foreground)
|
||||
if [[ "$2" == "presentation" ]]; then
|
||||
/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
fi
|
||||
if [[ "$2" == "video" ]]; then
|
||||
/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
fi
|
||||
*)
|
||||
echo "Running in task mode...";;
|
||||
esac
|
||||
|
||||
echo "Executing task..."
|
||||
cmd_result=$(systemctl --user "$1" "$2" 2>&1)
|
||||
cmd_exit=$?
|
||||
|
||||
if [[ "$cmd_exit" -eq 0 ]]; then
|
||||
echo "Succesfully exited, see:"
|
||||
if [[ -n "$cmd_result" ]]; then
|
||||
echo " -> $cmd_result"
|
||||
fi
|
||||
else
|
||||
echo "Something went wrong, see..."
|
||||
echo " -> $cmd_result"
|
||||
fi
|
||||
exit 0
|
||||
@@ -11,7 +11,6 @@ ExecStartPre=/usr/bin/sleep 5
|
||||
ExecStart=/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -11,7 +11,6 @@ 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/raspscreen/media \( -name "*.mp4" -o -name "*.mkv" -o -name "*.mov" -o -name "*.webm" \))'
|
||||
ExecStop=/usr/bin/killall vlc
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user