diff --git a/.dockerignore b/.dockerignore index 04204c7..2f774ad 100755 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ config +devops diff --git a/overlay/entrypoint.sh b/overlay/entrypoint.sh index 36b0922..980e88c 100644 --- a/overlay/entrypoint.sh +++ b/overlay/entrypoint.sh @@ -5,8 +5,8 @@ # File Created: Saturday, 8th January 2022 7:08:46 pm # Author: Josh.5 (jsunnex@gmail.com) # ----- -# Last Modified: Saturday, 15th January 2022 11:55:48 pm -# Modified By: Josh.5 (jsunnex@gmail.com) +# Last Modified: Sunday, 16th January 2022 2:30:07 am +# Modified By: Console and webGui login account (jsunnex@gmail.com) ### set -e @@ -42,12 +42,21 @@ for user_init_script in ${USER_HOME}/init.d/*.sh ; do echo echo "[ USER:${user_init_script}: executing... ]" sed -i 's/\r$//' "${user_init_script}" - source "${user_init_script}" + + # Execute user script in sub process. + # This way if it is messed up, we dont get caught in an init loop + chmod +x "${user_init_script}" + cat "${user_init_script}" | bash fi done +# Ensure all scripts are executable +chmod a+rwx /opt/scripts/*.sh + +# Start supervisord +echo echo "**** Starting supervisord ****"; mkdir -p /var/log/supervisor chmod a+rw /var/log/supervisor diff --git a/overlay/etc/home_directory_template/.bashrc b/overlay/etc/home_directory_template/.bashrc index a355b0c..097cf0e 100644 --- a/overlay/etc/home_directory_template/.bashrc +++ b/overlay/etc/home_directory_template/.bashrc @@ -7,3 +7,8 @@ alias ls='ls --color=auto' PS1='[\u@\h \W]\$ ' + +# Export user's home directory bin directories +PATH=$PATH:$HOME/.local/bin:$HOME/bin +# Export /usr/games +PATH=$PATH:/usr/games diff --git a/overlay/opt/scripts/install_lutris.sh b/overlay/opt/scripts/install_lutris.sh new file mode 100755 index 0000000..1f242ca --- /dev/null +++ b/overlay/opt/scripts/install_lutris.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +### +# File: install_lutris.sh +# Project: scripts +# File Created: Thursday, 1st January 1970 12:45:00 pm +# Author: Console and webGui login account (jsunnex@gmail.com) +# ----- +# Last Modified: Sunday, 16th January 2022 2:17:37 am +# Modified By: Console and webGui login account (jsunnex@gmail.com) +### + +pkg=lutris +script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ); +script_name=$( basename "${BASH_SOURCE[0]}" ) + + +install() { + if ! dpkg --get-selections | grep -q "^$pkg[[:space:]]*install$" >/dev/null; then + echo "deb http://download.opensuse.org/repositories/home:/strycore/Debian_10/ ./" | tee /etc/apt/sources.list.d/lutris.list + wget -q https://download.opensuse.org/repositories/home:/strycore/Debian_10/Release.key -O- | apt-key add - + apt-get update + apt-get -y install \ + lutris \ + python3-dbus + + sed -i '/Exec=lutris %U/c\Exec=/usr/games/lutris %U' /usr/share/applications/net.lutris.Lutris.desktop + fi +} + + +#INSTALLER: +source "${script_path}/installer.sh" diff --git a/overlay/opt/scripts/installer.sh b/overlay/opt/scripts/installer.sh new file mode 100644 index 0000000..ae8a4be --- /dev/null +++ b/overlay/opt/scripts/installer.sh @@ -0,0 +1,28 @@ + +if [[ "${script_path}" == *"opt/script"* ]]; then + while true; do + echo + read -p "Would you like to configure this container to install ${pkg^} on startup? (Y/N) " ans + + case $ans in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac + done + + # Install this script to the home directory init.d + dest_file="/home/${USER}/init.d/${script_name}" + cp -f "${script_path}/${script_name}" "${dest_file}" + # Remove anything under '#INSTALLER:' + sed -i '/^#INSTALLER.*$/Q' "${dest_file}" + # Append 'install' command + echo 'install' >> "${dest_file}" + echo + echo + echo "Installed init script '${dest_file}'" + echo "This script will install ${pkg^} when you next restart the container." + echo + read -s -p "Press any key to continue" + echo +fi diff --git a/overlay/usr/share/applications/net.lutris.Lutris.desktop b/overlay/usr/share/applications/net.lutris.Lutris.desktop new file mode 100644 index 0000000..abf4a8f --- /dev/null +++ b/overlay/usr/share/applications/net.lutris.Lutris.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Installer - Lutris +Categories=Game; +Exec=/opt/scripts/install_lutris.sh %U +Icon=installsoftware +Terminal=true +Type=Application diff --git a/overlay/usr/share/pixmaps/installsoftware.png b/overlay/usr/share/pixmaps/installsoftware.png new file mode 100644 index 0000000..8ebc10e Binary files /dev/null and b/overlay/usr/share/pixmaps/installsoftware.png differ