chore: working
This commit is contained in:
14
install.sh
14
install.sh
@@ -25,7 +25,7 @@ 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"
|
||||
Description="Systemec RaspScreen Presentation"
|
||||
Conflicts=video.service
|
||||
After=graphical.target
|
||||
|
||||
@@ -34,9 +34,10 @@ 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" \))'
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
ExecStart=/opt/raspscreen/bin/manage.sh start presentation --foreground
|
||||
ExecStop=/opt/raspscreen/bin/manage kill video
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
@@ -46,7 +47,7 @@ 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"
|
||||
Description="Systemec RaspScreen Video"
|
||||
Conflicts=presentation.service
|
||||
After=graphical.target
|
||||
|
||||
@@ -55,9 +56,10 @@ 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-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
|
||||
ExecStart=/opt/raspscreen/bin/manage.sh start video --foreground
|
||||
ExecStop=/opt/raspscreen/bin/manage kill video
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
46
manage.sh
46
manage.sh
@@ -9,6 +9,14 @@
|
||||
#
|
||||
# systemctl must be reachable from the path of the executing user.
|
||||
|
||||
app_name="raspscreen"
|
||||
|
||||
# Fallback for display selection
|
||||
if [[ -z $DISPLAY ]]; then
|
||||
echo "Triggered exporting display variable fallback..."
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
|
||||
runtime_id=$(id -u)
|
||||
if [[ "$runtime_id" -eq 0 ]]; then
|
||||
echo "Do not run as root. Run as the graphical user."
|
||||
@@ -17,7 +25,7 @@ fi
|
||||
|
||||
printf "Checking input..."
|
||||
case "$1" in
|
||||
restart|stop|start)
|
||||
restart|stop|start|kill)
|
||||
printf "Valid command...";;
|
||||
*)
|
||||
echo "Invalid command!"
|
||||
@@ -32,14 +40,46 @@ case "$2" in
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
if [[ "$1" == "kill" ]]; then
|
||||
if [[ "$2" == "presentation" ]]; then
|
||||
/usr/bin/killall libreoffice
|
||||
exit $?
|
||||
fi
|
||||
if [[ "$2" == "video" ]]; then
|
||||
/usr/bin/killall vlc
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
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" \))'
|
||||
media_file=$(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))
|
||||
|
||||
if [[ -z "$media_file" ]]; then
|
||||
echo "No compatible media file found. Wrong mode?"
|
||||
echo "Exiting in 20 seconds..."
|
||||
sleep 20s
|
||||
exit 1
|
||||
else
|
||||
/usr/bin/libreoffice --impress --show --norestore "$media_file"
|
||||
fi
|
||||
fi
|
||||
if [[ "$2" == "video" ]]; then
|
||||
/bin/sh -c 'exec /usr/bin/libreoffice --impress --show --norestore $(find /opt/raspscreen/media \( -name "*.pptx" -o -name "*.odp" \))'
|
||||
media_file=$(find /opt/raspscreen/media \( -name "*.mp4" -o -name "*.mkv" -o -name "*.mov" -o -name "*.webm" \))
|
||||
|
||||
if [[ -z "$media_file" ]]; then
|
||||
echo "No compatible media file found. Wrong mode?"
|
||||
echo "Exiting in 20 seconds..."
|
||||
sleep 20s
|
||||
exit 1
|
||||
else
|
||||
/usr/bin/vlc --fullscreen --loop --no-video-title --video-on-top --no-qt-fs-controller --qt-continue=0 "$media_file"
|
||||
fi
|
||||
fi
|
||||
echo "Process exited..."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Running in task mode...";;
|
||||
esac
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
Description="Systemec RaspScreen Presentation"
|
||||
Conflicts=video.service
|
||||
After=graphical.target
|
||||
|
||||
@@ -8,9 +8,10 @@ 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" \))'
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
ExecStart=/opt/raspscreen/bin/manage.sh start presentation --foreground
|
||||
ExecStop=/opt/raspscreen/bin/manage kill video
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description="Systemec RaspScreen"
|
||||
Description="Systemec RaspScreen Video"
|
||||
Conflicts=presentation.service
|
||||
After=graphical.target
|
||||
|
||||
@@ -8,9 +8,10 @@ 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-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
|
||||
ExecStart=/opt/raspscreen/bin/manage.sh start video --foreground
|
||||
ExecStop=/opt/raspscreen/bin/manage kill video
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user