3 Commits

Author SHA1 Message Date
Josh.5
0ad203f89d Testing KasmVNC 2023-07-08 04:57:25 +12:00
Josh.5
63754aaed5 Start using Flatpaks as the main install method for any desktop apps 2023-07-08 02:59:43 +12:00
Josh.5
e717cd209f Improvements to running Xorg with NVIDIA 2023-07-07 15:59:48 +12:00
30 changed files with 352 additions and 516 deletions

View File

@@ -64,6 +64,7 @@ RUN \
bash-completion \
curl \
git \
jq \
less \
man-db \
mlocate \
@@ -73,6 +74,8 @@ RUN \
pciutils \
pkg-config \
procps \
psmisc \
psutils \
rsync \
screen \
sudo \
@@ -169,10 +172,19 @@ RUN \
dbus-x11 \
libxcomposite-dev \
libxcursor1 \
wmctrl \
x11-utils \
x11-xfs-utils \
x11-xkb-utils \
x11-xserver-utils \
x11vnc \
xauth \
xbindkeys \
xclip \
xdotool \
xfishtank \
xfonts-base \
xinit \
xorg \
xserver-xorg-core \
xserver-xorg-input-evdev \
@@ -214,15 +226,37 @@ RUN \
&& \
echo
# Install openssh server
# Install desktop environment
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install openssh server ****" \
echo "**** Install desktop environment ****" \
&& apt-get install -y \
openssh-server \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
xfce4 \
xfce4-terminal \
msttcorefonts \
fonts-vlgothic \
gedit \
# Delete these as they are not needed at all
&& rm -f \
/usr/share/applications/software-properties-drivers.desktop \
/usr/share/applications/xfce4-about.desktop \
/usr/share/applications/xfce4-session-logout.desktop \
# Hide these apps. They can be displayed if a user really wants them.
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/xfce4-accessibility-settings.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/xfce4-color-settings.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/xfce4-mail-reader.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/vim.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/thunar-settings.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/thunar.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/pavucontrol.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/debian-uxterm.desktop \
&& sed -i '/[Desktop Entry]/a\NoDisplay=true' /usr/share/applications/debian-xterm.desktop \
# Force these apps to be "System" Apps rather than "Categories=System;Utility;Core;GTK;Filesystem;"
&& sed -i 's/^Categories=.*$/Categories=System;/' /usr/share/applications/xfce4-appfinder.desktop \
&& sed -i 's/^Categories=.*$/Categories=System;/' /usr/share/applications/thunar-bulk-rename.desktop \
&& sed -i 's/^Categories=.*$/Categories=System;/' /usr/share/applications/org.gnome.gedit.desktop \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
@@ -234,6 +268,79 @@ RUN \
&& \
echo
# Add support for flatpaks
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install flatpak support ****" \
&& apt-get install -y \
bridge-utils \
flatpak \
gnome-software-plugin-flatpak \
libpam-cgfs \
libvirt0 \
lxc \
uidmap \
&& \
echo "**** Configure flatpak ****" \
&& chmod u+s /usr/bin/bwrap \
&& flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Setup dind
# Ref:
# - https://github.com/docker-library/docker/blob/master/20.10/dind/Dockerfile
# - https://docs.nvidia.com/ai-enterprise/deployment-guide/dg-docker.html
ARG DOCKER_VERSION=20.10.18
ARG DOCKER_COMPOSE_VERSION=v2.11.2
RUN \
echo "**** Fetch Docker static binary package ****" \
&& cd /tmp \
&& wget -O /tmp/docker-${DOCKER_VERSION}.tgz \
https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
&& \
echo "**** Extract static binaries ****" \
&& mkdir -p /usr/local/bin \
&& tar --extract \
--file /tmp/docker-${DOCKER_VERSION}.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
--no-same-owner \
&& \
echo "**** Install docker-compose ****" \
&& wget -O /usr/local/bin/docker-compose "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64" \
&& chmod +x /usr/local/bin/docker-compose \
&& \
echo "**** Install nvidia runtime ****" \
&& distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list \
&& apt-get update \
&& apt-get install -y \
nvidia-container-toolkit \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
VOLUME /var/lib/docker
# TODO: Deprecate neko and noVNC for KasmVNC
# Install Neko server
COPY --from=m1k1o/neko:base /usr/bin/neko /usr/bin/neko
COPY --from=m1k1o/neko:base /var/www /var/www
@@ -303,97 +410,6 @@ RUN \
/tmp/websockify-* \
/tmp/websockify.tar.gz
# Add support for flatpaks
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install flatpak support ****" \
&& apt-get install -y \
bridge-utils \
flatpak \
libpam-cgfs \
libvirt0 \
lxc \
uidmap \
&& \
echo "**** Configure flatpak ****" \
&& chmod u+s /usr/bin/bwrap \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Install desktop environment
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install desktop environment ****" \
&& apt-get install -y \
xfce4 \
xfce4-terminal \
msttcorefonts \
fonts-vlgothic \
gedit \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Install Steam
RUN \
echo "**** Install steam ****" \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& echo steam steam/question select "I AGREE" | debconf-set-selections \
&& echo steam steam/license note '' | debconf-set-selections \
&& apt-get install -y \
&& apt-get install -y \
steam \
steam-devices \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Install firefox
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install firefox ****" \
&& apt-get install -y \
firefox-esr \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Setup audio streaming deps
RUN \
echo "**** Update apt database ****" \
@@ -434,31 +450,6 @@ RUN \
&& \
echo
# Install sunshine
ARG SUNSHINE_VERSION=0.20.0
RUN \
echo "**** Fetch Sunshine deb package ****" \
&& cd /tmp \
&& wget -O /tmp/sunshine-debian.deb \
https://github.com/LizardByte/sunshine/releases/download/v${SUNSHINE_VERSION}/sunshine-debian-bullseye-amd64.deb \
&& \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install Sunshine ****" \
&& apt-get install -y /tmp/sunshine-debian.deb \
&& apt-get install -y libboost-chrono1.74.0 \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Setup video streaming deps
RUN \
echo "**** Update apt database ****" \
@@ -470,6 +461,7 @@ RUN \
i965-va-driver-shaders \
libva2 \
vainfo \
vdpauinfo \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
@@ -481,49 +473,6 @@ RUN \
&& \
echo
# Setup dind
# Ref:
# - https://github.com/docker-library/docker/blob/master/20.10/dind/Dockerfile
# - https://docs.nvidia.com/ai-enterprise/deployment-guide/dg-docker.html
ARG DOCKER_VERSION=20.10.18
ARG DOCKER_COMPOSE_VERSION=v2.11.2
RUN \
echo "**** Fetch Docker static binary package ****" \
&& cd /tmp \
&& wget -O /tmp/docker-${DOCKER_VERSION}.tgz \
https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
&& \
echo "**** Extract static binaries ****" \
&& mkdir -p /usr/local/bin \
&& tar --extract \
--file /tmp/docker-${DOCKER_VERSION}.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
--no-same-owner \
&& \
echo "**** Install docker-compose ****" \
&& wget -O /usr/local/bin/docker-compose "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64" \
&& chmod +x /usr/local/bin/docker-compose \
&& \
echo "**** Install nvidia runtime ****" \
&& distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list \
&& apt-get update \
&& apt-get install -y \
nvidia-container-toolkit \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
VOLUME /var/lib/docker
# Configure default user and set env
ENV \
@@ -552,8 +501,7 @@ COPY overlay /
# Set display environment variables
ENV \
DISPLAY_CDEPTH="24" \
DISPLAY_DPI="96" \
DISPLAY_REFRESH="60" \
DISPLAY_REFRESH="120" \
DISPLAY_SIZEH="900" \
DISPLAY_SIZEW="1600" \
DISPLAY_VIDEO_PORT="DFP" \
@@ -561,7 +509,8 @@ ENV \
NVIDIA_DRIVER_CAPABILITIES="all" \
NVIDIA_VISIBLE_DEVICES="all" \
XORG_SOCKET_DIR="/tmp/.X11-unix" \
XDG_RUNTIME_DIR="/tmp/.X11-unix/run"
XDG_RUNTIME_DIR="/tmp/.X11-unix/run" \
XDG_DATA_DIRS="/home/default/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/"
# Set pulseaudio environment variables
ENV \

View File

@@ -399,7 +399,6 @@ COPY overlay /
# Set display environment variables
ENV \
DISPLAY_CDEPTH="24" \
DISPLAY_DPI="96" \
DISPLAY_REFRESH="60" \
DISPLAY_SIZEH="900" \
DISPLAY_SIZEW="1600" \

View File

@@ -114,7 +114,6 @@ cmd="docker run -d --name='${container_name}' \
-e TZ='Pacific/Auckland' \
-e USER_LOCALES='en_US.UTF-8 UTF-8' \
-e DISPLAY_CDEPTH='24' \
-e DISPLAY_DPI='96' \
-e DISPLAY_REFRESH='60' \
-e DISPLAY_SIZEH='720' \
-e DISPLAY_SIZEW='1280' \

View File

@@ -40,3 +40,11 @@ services:
- /opt/container-data/steam-headless/.X11-unix/:/tmp/.X11-unix/:rw
# Pulse audio socket. This will be shared with other containers so they can access the audio sink.
- /opt/container-data/steam-headless/pulse/:/tmp/pulse/:rw
# Store dind var files in a volume
- steam-headless-var-lib-docker:/var/lib/docker/:rw
# Store flatpak var files in a volume
- steam-headless-var-lib-flatpak:/var/lib/flatpak/:rw
volumes:
steam-headless-var-lib-docker:
steam-headless-var-lib-flatpak:

View File

@@ -70,10 +70,7 @@ mkdir -p ${XDG_RUNTIME_DIR}
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}
# Ensure only the 'default' user can access this directory
chmod 700 ${XDG_RUNTIME_DIR}
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
# Ensure the start-desktop.sh script is executable
chmod +x /usr/bin/start-desktop.sh
# Set the default background for gnome based desktop
# Set the default background
mkdir -p /etc/alternatives
ln -sf /usr/share/backgrounds/steam.jpg /etc/alternatives/desktop-background
chmod a+r /etc/alternatives/desktop-background

View File

@@ -13,9 +13,9 @@ else
# Ensure pulseaudio directories have the correct permissions
mkdir -p \
${PULSE_SOCKET_DIR} \
/home/${USER}/.config/pulse
${USER_HOME:?}/.config/pulse
chmod -R a+rw ${PULSE_SOCKET_DIR}
chown -R ${PUID}:${PGID} /home/${USER}/.config/pulse
chown -R ${PUID}:${PGID} ${USER_HOME:?}/.config/pulse
# Configure the palse audio socket
sed -i "s|^; default-server.*$|default-server = ${PULSE_SERVER}|" /etc/pulse/client.conf
@@ -30,9 +30,6 @@ else
if [ "X${DEBUGGING:-}" == "X" ]; then
sed -i 's|^; log-level.*$|log-level = debug|' /etc/pulse/daemon.conf
fi
# Make startup script executable
chmod +x /usr/bin/start-pulseaudio.sh
fi
chown -R ${USER} /etc/pulse

View File

@@ -64,10 +64,15 @@ function install_nvidia_driver {
${USER_HOME}/Downloads/NVIDIA_${nvidia_host_driver_version}.run \
--silent \
--accept-license \
--no-kernel-module \
--skip-depmod \
--skip-module-unload \
--no-kernel-modules \
--no-kernel-module-source \
--install-compat32-libs \
--no-nouveau-check \
--no-nvidia-modprobe \
--no-systemd \
--no-distro-scripts \
--no-rpms \
--no-backup \
--no-check-for-alternate-installs \
@@ -123,17 +128,13 @@ if [[ ! -z ${nvidia_pci_address} ]]; then
else
echo "**** No NVIDIA device found ****";
fi
# Intel GPU
if [[ ! -z ${intel_cpu_model} ]]; then
echo "**** Found Intel device '${intel_cpu_model}' ****";
install_intel_gpu_driver
else
echo "**** No Intel device found ****";
fi
# Intel Arc
# Intel Arc GPU or Intel CPU with possible iGPU
if [[ ! -z ${intel_gpu_model} ]]; then
echo "**** Found Intel device '${intel_gpu_model}' ****";
install_intel_gpu_driver
elif [[ ! -z ${intel_cpu_model} ]]; then
echo "**** Found Intel device '${intel_cpu_model}' ****";
install_intel_gpu_driver
else
echo "**** No Intel device found ****";
fi

View File

@@ -13,13 +13,18 @@ fi
export nvidia_gpu_hex_id=$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select}" 2> /dev/null | sed -n 2p)
export monitor_connected=$(cat /sys/class/drm/card*/status | awk '/^connected/ { print $1; }' | head -n1)
# Fech current configuration (if modified in UI)
if [ -f "${USER_HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml" ]; then
new_display_sizew=$(cat ${USER_HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml | grep Resolution | head -n1 | grep -oP '(?<=value=").*?(?=")' | cut -d'x' -f1)
new_display_sizeh=$(cat ${USER_HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml | grep Resolution | head -n1 | grep -oP '(?<=value=").*?(?=")' | cut -d'x' -f2)
if [ "${new_display_sizew}x" != "x" ] && [ "${new_display_sizeh}x" != "x" ]; then
new_display_refresh=$(cat ${USER_HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml | grep RefreshRate | head -n1 | grep -oP '(?<=value=").*?(?=")' | cut -d'x' -f2)
if [ "${new_display_sizew}x" != "x" ] && [ "${new_display_sizeh}x" != "x" ] && [ "${new_display_refresh}x" != "x" ]; then
export DISPLAY_SIZEW="${new_display_sizew}"
export DISPLAY_SIZEH="${new_display_sizeh}"
# Round refresh rate to closest multiple of 60
export DISPLAY_REFRESH="$(echo ${new_display_refresh} | awk '{rounded = int(($1 + 30) / 60) * 60; if (rounded < 30) rounded += 60; print rounded}')"
fi
fi
@@ -33,9 +38,17 @@ function configure_nvidia_x_server {
echo "Configuring X11 with PCI bus ID: '${bus_id}'"
export MODELINE=$(cvt -r "${DISPLAY_SIZEW}" "${DISPLAY_SIZEH}" "${DISPLAY_REFRESH}" | sed -n 2p)
echo "Writing X11 config with ${MODELINE}"
nvidia-xconfig --virtual="${DISPLAY_SIZEW}x${DISPLAY_SIZEH}" --depth="${DISPLAY_CDEPTH}" --mode=$(echo "${MODELINE}" | awk '{print $2}' | tr -d '"') --allow-empty-initial-configuration --no-probe-all-gpus --busid="${bus_id}" --only-one-x-screen --connected-monitor="${DISPLAY_VIDEO_PORT}"
sed -i '/Driver\s\+"nvidia"/a\ Option "ModeValidation" "NoMaxPClkCheck, NoEdidMaxPClkCheck, NoMaxSizeCheck, NoHorizSyncCheck, NoVertRefreshCheck, NoVirtualSizeCheck, NoExtendedGpuCapabilitiesCheck, NoTotalSizeCheck, NoDualLinkDVICheck, NoDisplayPortBandwidthCheck, AllowNon3DVisionModes, AllowNonHDMI3DModes, AllowNonEdidModes, NoEdidHDMI2Check, AllowDpInterlaced"' /etc/X11/xorg.conf
connected_monitor="--use-display-device=None"
if [[ "X${DISPLAY_VIDEO_PORT:-}" != "X" ]]; then
connected_monitor="--connected-monitor=${DISPLAY_VIDEO_PORT:?}"
fi
nvidia-xconfig --virtual="${DISPLAY_SIZEW:?}x${DISPLAY_SIZEH:?}" --depth="${DISPLAY_CDEPTH:?}" --mode=$(echo "${MODELINE:?}" | awk '{print $2}' | tr -d '"') --allow-empty-initial-configuration --no-probe-all-gpus --busid="${bus_id:?}" --no-multigpu --no-sli --no-base-mosaic --only-one-x-screen ${connected_monitor:?}
sed -i '/Driver\s\+"nvidia"/a\ Option "ModeValidation" "NoMaxPClkCheck, NoEdidMaxPClkCheck, NoMaxSizeCheck, NoHorizSyncCheck, NoVertRefreshCheck, NoVirtualSizeCheck, NoTotalSizeCheck, NoDualLinkDVICheck, NoDisplayPortBandwidthCheck, AllowNon3DVisionModes, AllowNonHDMI3DModes, AllowNonEdidModes, NoEdidHDMI2Check, AllowDpInterlaced"\n Option "HardDPMS" "False"' /etc/X11/xorg.conf
sed -i '/Section\s\+"Monitor"/a\ '"${MODELINE}" /etc/X11/xorg.conf
# Prevent interference between GPUs
echo -e "Section \"ServerFlags\"\n Option \"AutoAddGPU\" \"false\"\nEndSection" | tee -a /etc/X11/xorg.conf > /dev/null
# Configure primary GPU
sed -i '/Driver\s\+"nvidia"/a\ Option "AllowEmptyInitialConfiguration"\n Option "PrimaryGPU" "yes"' /usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf
}
# Allow anybody for running x server
@@ -44,13 +57,14 @@ function configure_x_server {
if grep -Fxq "allowed_users=console" /etc/X11/Xwrapper.config; then
echo "Configure Xwrapper.config"
sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
echo 'needs_root_rights=yes' >> /etc/X11/Xwrapper.config
fi
# Remove previous Xorg config
rm -f /etc/X11/xorg.conf
# Ensure the X socket path exists
mkdir -p ${XORG_SOCKET_DIR}
mkdir -p ${XORG_SOCKET_DIR:?}
# Clear out old lock files
display_file=${XORG_SOCKET_DIR}/X${DISPLAY#:}
@@ -85,8 +99,8 @@ function configure_x_server {
else
echo "Leaving evdev inputs disabled"
fi
monitor_connected=$(cat /sys/class/drm/card*/status | awk '/^connected/ { print $1; }' | head -n1)
# Configure dummy config if no monitor is connected (not applicable to NVIDIA)
if [[ "X${monitor_connected}" == "X" ]]; then
echo "No monitors connected. Installing dummy xorg.conf"
# Use a dummy display input

View File

@@ -5,7 +5,6 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
if [ ! -S /var/run/docker.sock ]; then
echo "Enable Dockerd daemon"
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/dind.ini
chmod +x /usr/bin/start-dind.sh
else
echo "Docker socket has been passed in from host. Using that instead"
fi
@@ -14,9 +13,9 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
echo "Add user '${USER}' to docker group for sudoless execution"
groupadd docker
usermod -aG docker ${USER}
mkdir -p /home/${USER}/.docker
chown -R ${PUID}:${PGID} /home/${USER}/.docker
chmod -R g+rwx /home/${USER}/.docker
mkdir -p ${USER_HOME:?}/.docker
chown -R ${PUID}:${PGID} ${USER_HOME:?}/.docker
chmod -R g+rwx ${USER_HOME:?}/.docker
fi
else
echo "Dockerd daemon not available when container is run in 'secondary' mode"

View File

@@ -5,7 +5,6 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
if [ "${ENABLE_SUNSHINE:-}" = "true" ]; then
echo "Enable Sunshine server"
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/sunshine.ini
chmod +x /usr/bin/start-sunshine.sh
else
echo "Disable Sunshine server"
fi

View File

@@ -12,5 +12,3 @@ PS1='[\u@\h \W]\$ '
PATH=$PATH:$HOME/.local/bin:$HOME/bin
# Export /usr/games
PATH=$PATH:/usr/games
# Export flatpak data directories
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"

View File

@@ -4,11 +4,10 @@ Version=0.9.4
Type=Application
Name=Steam
Comment=launch steam on login
Exec=/usr/games/steam %U -silent
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/steam-wrapper --file-forwarding com.valvesoftware.Steam @@u %U @@ -silent
Icon=steam
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

View File

@@ -5,7 +5,6 @@ autostart=false
autorestart=true
user=root
command=/usr/bin/start-dind.sh
environment=DISPLAY="%(ENV_DISPLAY)s",DISPLAY_DPI="%(ENV_DISPLAY_DPI)s",XDG_RUNTIME_DIR="/tmp/runtime-root"
stopsignal=INT
stdout_logfile=/home/%(ENV_USER)s/.cache/log/dind.log
stdout_logfile_maxbytes=10MB

View File

@@ -45,3 +45,20 @@ stdout_logfile_backups=7
stderr_logfile=/home/%(ENV_USER)s/.cache/log/vncproxy.err.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=7
# [program:kasmxproxy]
# priority=30
# autostart=false
# autorestart=true
# numprocs=1
# startsecs=0
# user=%(ENV_USER)s
# command=/usr/sbin/nginx -c /opt/noVNC/nginx.conf
# environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
# stopsignal=INT
# stdout_logfile=/home/%(ENV_USER)s/.cache/log/vncproxy.log
# stdout_logfile_maxbytes=10MB
# stdout_logfile_backups=7
# stderr_logfile=/home/%(ENV_USER)s/.cache/log/vncproxy.err.log
# stderr_logfile_maxbytes=10MB
# stderr_logfile_backups=7

View File

@@ -5,7 +5,7 @@ autostart=false
autorestart=true
user=root
command=/usr/bin/start-xorg.sh
environment=DISPLAY="%(ENV_DISPLAY)s",DISPLAY_DPI="%(ENV_DISPLAY_DPI)s",XDG_RUNTIME_DIR="/tmp/runtime-root"
environment=DISPLAY="%(ENV_DISPLAY)s",XDG_RUNTIME_DIR="/tmp/runtime-root"
stopsignal=INT
stdout_logfile=/home/%(ENV_USER)s/.cache/log/xorg.log
stdout_logfile_maxbytes=10MB

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
echo "**** Installing/upgrading Firefox via flatpak ****"
# Install Firefox
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install --assumeyes --noninteractive --or-update flathub org.mozilla.firefox
# Configure Firefox as the default browser
echo "Configure Firefox..."
custom_webbrowser="$(cat <<EOF
"libraryfolders"
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-CommandsWithParameter=${USER_HOME:?}/.local/share/flatpak/exports/bin/org.mozilla.firefox "%s"
Icon=org.mozilla.firefox
Name=org.mozilla.firefox
X-XFCE-Commands=${USER_HOME:?}/.local/share/flatpak/exports/bin/org.mozilla.firefox
EOF
)"
if [[ ! -f ${USER_HOME:?}/.local/share/xfce4/helpers/custom-WebBrowser.desktop ]]; then
mkdir -p ${USER_HOME:?}/.local/share/xfce4/helpers
echo "${custom_webbrowser}" > ${USER_HOME:?}/.local/share/xfce4/helpers/custom-WebBrowser.desktop
gio mime x-scheme-handler/http org.mozilla.firefox.desktop
fi
echo "DONE"

View File

@@ -1,89 +0,0 @@
#!/usr/bin/env bash
###
# File: install_heroic.sh
# Project: scripts
# File Created: Thursday, 1st January 1970 12:00:00 pm
# Author: Console and webGui login account (jsunnex@gmail.com)
# -----
# Last Modified: Wednesday, 31st August 2022 10:01:31 pm
# Modified By: Josh.5 (jsunnex@gmail.com)
###
pkg=heroic
script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
script_name=$( basename "${BASH_SOURCE[0]}" )
github_get_all_release() {
REPO="${1}";
curl --silent "https://api.github.com/repos/${REPO}/releases" \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/';
}
github_get_release_download_url() {
REPO="${1}";
TAG="${2}";
TYPE="${3}";
IGNORE="${4}";
curl --silent "https://api.github.com/repos/${REPO}/releases/tags/${TAG}" \
| grep '"browser_download_url":' \
| sed -E 's/.*"([^"]+)".*/\1/' \
| grep -P "${TYPE}" \
| grep -P "${TYPE}" \
| head -n1;
}
install() {
# Download Heroic deb package if it does not yet exist
__latest_heroic_release=$(github_get_all_release "Heroic-Games-Launcher/HeroicGamesLauncher" | head -n1)
if [[ ! -f "/home/${USER}/Downloads/heroic-${__latest_heroic_release}.deb" ]]; then
__heroic_download_link=$(github_get_release_download_url "Heroic-Games-Launcher/HeroicGamesLauncher" "${__latest_heroic_release}" ".deb")
wget -O /tmp/heroic.deb "${__heroic_download_link}"
[[ $? -gt 0 ]] && echo "Error downloading pacakge. Exit!" && return 1
mv /tmp/heroic.deb "/home/${USER}/Downloads/heroic-${__latest_heroic_release}.deb"
fi
# Install/Update the latest version of Heroic
[[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && APT_UPDATED=true
apt-get install -y "/home/${USER}/Downloads/heroic-${__latest_heroic_release}.deb"
# Install/Update deps for HeroicBashLauncher
[[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && APT_UPDATED=true
apt-get install -y zenity
# Install/Update the latest version HeroicBashLauncher
__latest_hbl_release=$(github_get_all_release "redromnon/HeroicBashLauncher" | head -n1)
if [[ ! -e "/home/${USER}/HeroicBashLauncher/.${__latest_hbl_release}" ]]; then
# Download HeroicBashLauncher
if [[ ! -f "/home/${USER}/Downloads/HeroicBashLauncher-${__latest_hbl_release}.zip" ]]; then
__hbl_download_link=$(github_get_release_download_url "redromnon/HeroicBashLauncher" "${__latest_hbl_release}" "\d\.zip")
wget -O /tmp/hbl.zip "${__hbl_download_link}"
[[ $? -gt 0 ]] && echo "Error downloading pacakge. Exit!" && return 1
mv /tmp/hbl.zip "/home/${USER}/Downloads/HeroicBashLauncher-${__latest_hbl_release}.zip"
fi
# Extract HeroicBashLauncher
mkdir -p "/home/${USER}/HeroicBashLauncher"
rm -rf "/tmp/hbl"
su ${USER} -c "mkdir -p /tmp/hbl && cd /tmp/hbl && unzip -o /home/${USER}/Downloads/HeroicBashLauncher-${__latest_hbl_release}.zip"
su ${USER} -c "cp -rfv /tmp/hbl/HeroicBashLauncher*/HeroicBashLauncher/* /home/${USER}/HeroicBashLauncher/"
chmod +x "/home/${USER}/HeroicBashLauncher/HeroicBashLauncher"
# Setup script in user PATH
su ${USER} -c "mkdir -p /home/default/.local/bin"
su ${USER} -c "ln -sf /home/${USER}/HeroicBashLauncher/HeroicBashLauncher /home/${USER}/.local/bin/HeroicBashLauncher"
fi
# Remove installer shortcut
rm -f /usr/share/applications/install.heroic.desktop
}
#INSTALLER:
source "${script_path}/installer.sh"

View File

@@ -1,70 +0,0 @@
#!/usr/bin/env bash
###
# File: install_legendary.sh
# Project: scripts
# File Created: Thursday, 1st January 1970 12:00:00 pm
# Author: Console and webGui login account (jsunnex@gmail.com)
# -----
# Last Modified: Sunday, 16th January 2022 5:44:25 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
pkg=legendary
script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
script_name=$( basename "${BASH_SOURCE[0]}" )
github_get_all_release() {
REPO="${1}";
curl --silent "https://api.github.com/repos/${REPO}/releases" \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/';
}
install() {
if ! command -v ${pkg} >/dev/null; then
# Download/install the latest legendary binary
latest_release=$(github_get_all_release derrod/legendary | head -n1)
download_url="https://github.com/derrod/legendary/releases/download/${latest_release}/legendary"
wget -O "/tmp/legendary-${latest_release}" "${download_url}"
chmod +x /tmp/legendary-${latest_release}
cp -f /tmp/legendary-${latest_release} /usr/bin/legendary-${latest_release}
rm -f /usr/bin/legendary
ln -s /usr/bin/legendary-${latest_release} /usr/bin/legendary
fi
if ! command -v rare >/dev/null; then
# Install rare for a gui
python3 -m pip install Rare
fi
if ! command -v steam-legendary-wrapper >/dev/null; then
# Download/install the steam-legendary-wrapper script
wget -O "/tmp/steam-legendary-wrapper.sh" \
"https://raw.githubusercontent.com/toalex77/steam-legendary-wrapper/main/steam-legendary-wrapper.sh"
chmod +x /tmp/steam-legendary-wrapper.sh
rm -f /usr/bin/steam-legendary-wrapper
cp -f /tmp/steam-legendary-wrapper.sh /usr/bin/steam-legendary-wrapper
fi
# Remove installer shortcut
rm -f /usr/share/applications/install.legendary.desktop
# Add launcher shortcut
cat << EOF > /usr/share/applications/rare.desktop
[Desktop Entry]
Name=Rare - (Epic Games Store)
Comment=A frontend for legendary, the open source Epic Games Store alternative
GenericName=Rare - (Epic Games Store)
X-GNOME-FullName=Rare - (Epic Games Store)
Exec=/usr/local/bin/rare %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=rare
Categories=Game;
EOF
}
#INSTALLER:
source "${script_path}/installer.sh"

View File

@@ -1,35 +0,0 @@
#!/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 4:54:11 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
# Remove installer shortcut
rm -f /usr/share/applications/install.lutris.desktop
}
#INSTALLER:
source "${script_path}/installer.sh"

38
overlay/opt/scripts/install_protonup.sh Normal file → Executable file
View File

@@ -1,34 +1,14 @@
#!/usr/bin/env bash
###
# File: install_protonup.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 4:55:12 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
pkg=protonup-ng
script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
script_name=$( basename "${BASH_SOURCE[0]}" )
echo "**** Installing/upgrading ProtonUp-Qt via flatpak ****"
# Install ProtonUp-Qt
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install --assumeyes --noninteractive --or-update net.davidotek.pupgui2
install() {
if ! command -v ${pkg} >/dev/null; then
# Install application
python3 -m pip install ${pkg}
# Set installation path as user
# Note: Run command with su because init processes are run as root but this is a user thing...
su ${USER} -c "${pkg} -d '/home/${USER}/.steam/root/compatibilitytools.d/'"
# Update to the latest version on startup using the users Downloads directory
su ${USER} -c "${pkg} -y -o '/home/${USER}/Downloads/'" &
fi
# Configure Firefox as the default browser
echo "Configure ProtonUp-Qt..."
sed -i 's/^Categories=.*$/Categories=Utility;/' \
${USER_HOME}/.local/share/flatpak/exports/share/applications/net.davidotek.pupgui2.desktop
# Remove installer shortcut
rm -f /usr/share/applications/install.protonup.desktop
}
#INSTALLER:
source "${script_path}/installer.sh"
echo "DONE"

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
echo "**** Installing/upgrading Steam via flatpak ****"
# Install Steam client
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install --assumeyes --noninteractive --or-update flathub com.valvesoftware.Steam
# Configure any required overrides
flatpak --user override --filesystem=/mnt/games com.valvesoftware.Steam
# TODO: Check if we should add /dev/dri here??
# Configure default steam library paths
echo "Configure Steam default libraries..."
mkdir -p /mnt/games/GameLibrary/SteamLibrary
libraryfolders="$(cat <<EOF
"libraryfolders"
{
"0"
{
"path" "${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam"
"label" ""
"contentid" "5619710282499379610"
"totalsize" "0"
"update_clean_bytes_tally" "0"
"time_last_update_corruption" "0"
"apps"
{
}
}
"1"
{
"path" "/mnt/games/GameLibrary/SteamLibrary"
"label" "Mounted Games"
"contentid" "4437054932394438372"
"totalsize" "0"
"update_clean_bytes_tally" "0"
"time_last_update_corruption" "0"
"apps"
{
}
}
}
EOF
)"
if [[ ! -f ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/libraryfolders.vdf ]]; then
mkdir -p ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps
echo "${libraryfolders}" > ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/libraryfolders.vdf
fi
if [[ ! -f ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/config/libraryfolders.vdf ]]; then
mkdir -p ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/config
echo "${libraryfolders}" > ${USER_HOME:?}/.var/app/com.valvesoftware.Steam/.local/share/Steam/config/libraryfolders.vdf
fi
echo "DONE"

View File

@@ -1,28 +0,0 @@
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 enter to continue"
echo
fi

View File

@@ -5,7 +5,7 @@
# File Created: Thursday, 1st January 1970 12:00:00 pm
# Author: Console and webGui login account (jsunnex@gmail.com)
# -----
# Last Modified: Wednesday, 26th January 2022 5:38:23 pm
# Last Modified: Saturday, 8th July 2023 2:34:11 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
set -e
@@ -19,27 +19,23 @@ trap _term SIGTERM SIGINT
# CONFIGURE:
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
export $(dbus-launch)
# EXECUTE PROCESS:
# Install/Upgrade user apps
if [[ ! -f /tmp/.desktop-apps-updated.lock ]]; then
source /opt/scripts/install_steam.sh
source /opt/scripts/install_firefox.sh
source /opt/scripts/install_protonup.sh
touch /tmp/.desktop-apps-updated.lock
fi
# Wait for the X server to start
wait_for_x
# Run the desktop environment in order of priority
if [[ -e /usr/bin/cinnamon-session ]]; then
/usr/bin/cinnamon-session --display=${DISPLAY} &
desktop_pid=$!
elif [[ -e /usr/bin/mate-session ]]; then
/usr/bin/mate-session &
desktop_pid=$!
elif [[ -e /usr/bin/startplasma-x11 ]]; then
/usr/bin/startplasma-x11 &
desktop_pid=$!
elif [[ -e /usr/bin/startxfce4 ]]; then
/usr/bin/startxfce4 &
desktop_pid=$!
fi
# Run the desktop environment
echo "**** Starting Xfce4 ****"
/usr/bin/startxfce4 &
desktop_pid=$!
# WAIT FOR CHILD PROCESS:

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
###
# File: start-kasmvnc.sh
# Project: bin
# File Created: Thursday, 1st January 1970 12:00:00 pm
# Author: Console and webGui login account (jsunnex@gmail.com)
# -----
# Last Modified: Saturday, 8th July 2023 4:44:25 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
set -e
source /usr/bin/common-functions.sh
# CATCH TERM SIGNAL:
_term() {
kill -TERM "$kasmxproxy_pid" 2>/dev/null
pkill --signal TERM -P "$xvnc_pid" 2>/dev/null
}
trap _term SIGTERM SIGINT
# EXECUTE PROCESS:
# Wait for the X server to start
wait_for_x
# Start the Xvnc server
# vncserver :88 -fg -noxstartup -websocketPort ${PORT_NOVNC_WEB:?} -disableBasicAuth -interface 0.0.0.0 -dry-run
#eval "$(vncserver :88 -fg -noxstartup -websocketPort ${PORT_NOVNC_WEB:?} -disableBasicAuth -interface 0.0.0.0 -dry-run)" &
## xvnc_command="$(vncserver :88 -fg -noxstartup -websocketPort 8438 -disableBasicAuth -interface 0.0.0.0 -dry-run)"
## bash -c "${xvnc_command}" &
# NOTE: I've run it like this because the -fg is not doing anything when executed with vncserver.
# This prints the Xvnc command which is then executed.
vnc_server_args="${vnc_server_args:-} -hw3d -drinode /dev/dri/renderD128"
eval "$(vncserver :88 -fg -noxstartup -websocketPort ${PORT_NOVNC_WEB:?} -disableBasicAuth -interface 0.0.0.0 ${vnc_server_args:-} -dry-run)" &
xvnc_pid=$!
# Wait a few seconds for the Xvnc service to start
sleep 3
# Start the Kasm X Proxy
kasmxproxy -a :55 -v :88 &
kasmxproxy_pid=$!
# WAIT FOR CHILD PROCESS:
wait "$xvnc_pid"
wait "$kasmxproxy_pid"

View File

@@ -9,6 +9,7 @@
# Modified By: Josh.5 (jsunnex@gmail.com)
###
set -e
source /usr/bin/common-functions.sh
# CATCH TERM SIGNAL:
_term() {
@@ -19,18 +20,29 @@ trap _term SIGTERM SIGINT
# EXECUTE PROCESS:
# Wait for udev
MAX=10
CT=0
while [ ! -f /tmp/.udev-started ]; do
sleep 1
CT=$(( CT + 1 ))
if [ "$CT" -ge "$MAX" ]; then
LOG "FATAL: $0: Gave up waiting for udev server to start"
exit 11
fi
done
wait_for_udev
# Run X server
/usr/bin/Xorg -ac -noreset -novtswitch -sharevts -dpi "${DISPLAY_DPI}" +extension "GLX" +extension "RANDR" +extension "RENDER" vt7 "${DISPLAY}" &
/usr/bin/Xorg \
-ac \
-noreset \
-novtswitch \
-sharevts \
+extension RANDR \
+extension RENDER \
+extension GLX \
+extension XVideo \
+extension DOUBLE-BUFFER \
+extension SECURITY \
+extension DAMAGE \
+extension X-Resource \
-extension XINERAMA -xinerama \
+extension Composite +extension COMPOSITE \
-dpms \
-s off \
-nolisten tcp \
-iglx \
-verbose \
vt7 "${DISPLAY:?}" &
xorg_pid=$!

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Name=Installer - Heroic (Epic Games Launcher)
Categories=Game;
Exec=/opt/scripts/install_heroic.sh %U
Icon=installsoftware
Terminal=true
Type=Application

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Name=Installer - Rare/Legendary (Epic Games Commandline Launcher)
Categories=Game;
Exec=/opt/scripts/install_legendary.sh %U
Icon=installsoftware
Terminal=true
Type=Application

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Name=Installer - Lutris
Categories=Game;
Exec=/opt/scripts/install_lutris.sh %U
Icon=installsoftware
Terminal=true
Type=Application

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Name=Installer - Protonup
Categories=Game;
Exec=/opt/scripts/install_protonup.sh %U
Icon=installsoftware
Terminal=true
Type=Application

View File

@@ -1,7 +0,0 @@
{
"file_format_version" : "1.0.0",
"ICD": {
"library_path": "libGLX_nvidia.so.0",
"api_version" : "1.2.155"
}
}