Files
raspscreen/install.sh
DaanSelen ab1b46d71c
Some checks failed
Cross-Compile Binaries / compile-linux (push) Failing after 3m4s
Cross-Compile Binaries / compile-windows (push) Has been cancelled
chore: reorder and expand script
2026-01-13 10:49:20 +01:00

64 lines
1.7 KiB
Bash

#!/bin/bash
program_name="akartontv"
runtime_id=$(id -u)
userland_name="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
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} -m 755
chown -R ${userland_name}:${userland_name} /opt/${program_name}
fi
cat > /home/${userland_name}/.config/systemd/user/presentation.service << EOF
[Unit]
Description="Systemec Akarton Raspberry Pi Uploader Program (SARPUS)"
After=graphical.target
[Service]
Type=simple
Environment=DISPLAY=:0
WorkingDirectory=/opt/akartontv
ExecStartPre=/usr/bin/sleep 5
ExecStart=/usr/bin/libreoffice --impress --show /opt/akartontv/presentation.pptx --norestore
ExecStop=/usr/bin/killall libreoffice
Restart=always
Restart=on-failure
RestartSec=2
[Install]
WantedBy=default.target
EOF
cat > /home/${userland_name}/.config/systemd/user/video.service << EOF
[Unit]
Description="Systemec Akarton Raspberry Pi Uploader Program (SARPUS)"
After=graphical.target
[Service]
Type=simple
Environment=DISPLAY=:0
WorkingDirectory=/opt/akartontv
ExecStart=/usr/bin/vlc --loop /opt/akartontv/video.mp4 -I dummy --no-video-title
ExecStop=/usr/bin/killall vlc
Restart=always
Restart=on-failure
RestartSec=2
[Install]
WantedBy=default.target
EOF