Files
raspscreen/dyn-com-install.sh
DaanSelen a08976890d
All checks were successful
Cross-Compile Binaries / compile-linux (push) Successful in 3m57s
Cross-Compile Binaries / compile-windows (push) Successful in 9m27s
feat: further work on the wrapper
2026-02-06 11:34:24 +01:00

66 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
#
# Development builder
#
install_file="install.sh"
cat > ./$install_file << EOF
#!/bin/bash
program_name="raspscreen"
runtime_id=\$(id -u)
userland_name="\${1-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 \\
default-jre libreoffice-impress libreoffice-java-common psmisc 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
fi
# Create the program place onto /opt
if [[ ! -d /opt/\${program_name} ]]; then
mkdir -p /opt/\${program_name}/media/current -m 755
mkdir -p /opt/\${program_name}/bin -m 755
fi
# THIS MUST BE THE SAME AS \$REPO/service-files/presentation.service
cat > /home/\${userland_name}/.config/systemd/user/presentation.service << EOF
EOF
cat ./service-files/presentation.service >> ./$install_file
echo -e "\nEOF\n" >> ./$install_file
cat >> ./$install_file << EOF
# THIS MUST BE THE SAME AS \$REPO/service-files/video.service
cat > /home/\${userland_name}/.config/systemd/user/video.service << EOF
EOF
cat ./service-files/video.service >> ./$install_file
echo -e "\nEOF\n" >> ./$install_file
cat >> ./$install_file << EOF
# THIS MUST BE THE AS \$REPO/manage.sh
cat > /opt/raspscreen/bin/manage.sh << EOF
EOF
# Make sure to prefix all $ with a \
sed 's/\$/\\$/g' ./manage.sh >> "$install_file"
echo -e "\nEOF\n" >> ./$install_file
cat >> ./$install_file << EOF
chmod +x /opt/raspscreen/bin/manage.sh
chown -Rv \${userland_name}:\${userland_name} /home/\${userland_name}/.config/systemd
chown -Rv \${userland_name}:\${userland_name} /opt/\${program_name}
su \${userland_name} -c "systemctl --user daemon-reload"
echo "Self-destruction NOW!"
rm \$(pwd)/\$0
EOF