Improvements to the init scripts
This commit is contained in:
@@ -22,6 +22,26 @@ if [[ -f /version.txt ]]; then
|
|||||||
cat /version.txt
|
cat /version.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function print_header {
|
||||||
|
# Magenta
|
||||||
|
echo -e "\e[35m**** ${@} ****\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_step_header {
|
||||||
|
# Cyan
|
||||||
|
echo -e "\e[36m - ${@}\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_warning {
|
||||||
|
# Yellow
|
||||||
|
echo -e "\e[33mWARNING: ${@}\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_error {
|
||||||
|
# Red
|
||||||
|
echo -e "\e[31mERROR: ${@}\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
# Execute all container init scripts
|
# Execute all container init scripts
|
||||||
for init_script in /etc/cont-init.d/*.sh ; do
|
for init_script in /etc/cont-init.d/*.sh ; do
|
||||||
echo
|
echo
|
||||||
@@ -59,9 +79,9 @@ touch /tmp/.first-run-user-init-scripts
|
|||||||
|
|
||||||
# Start supervisord
|
# Start supervisord
|
||||||
echo
|
echo
|
||||||
echo "**** Starting supervisord ****";
|
print_header "Starting supervisord";
|
||||||
echo "Logging all root services to '/var/log/supervisor/'"
|
print_step_header "Logging all root services to '/var/log/supervisor/'"
|
||||||
echo "Logging all user services to '/home/${USER:?}/.cache/log/'"
|
print_step_header "Logging all user services to '/home/${USER:?}/.cache/log/'"
|
||||||
echo
|
echo
|
||||||
mkdir -p /var/log/supervisor
|
mkdir -p /var/log/supervisor
|
||||||
chmod a+rw /var/log/supervisor
|
chmod a+rw /var/log/supervisor
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ PGID=${PGID:-100}
|
|||||||
UMASK=${UMASK:-000}
|
UMASK=${UMASK:-000}
|
||||||
USER_PASSWORD=${USER_PASSWORD:-password}
|
USER_PASSWORD=${USER_PASSWORD:-password}
|
||||||
|
|
||||||
echo "**** Configure default user ****"
|
print_header "Configure default user"
|
||||||
|
|
||||||
echo "Setting default user uid=${PUID}(${USER}) gid=${PGID}(${USER})"
|
print_step_header "Setting default user uid=${PUID}(${USER}) gid=${PGID}(${USER})"
|
||||||
usermod -o -u "${PUID}" ${USER}
|
usermod -o -u "${PUID}" ${USER}
|
||||||
groupmod -o -g "${PGID}" ${USER}
|
groupmod -o -g "${PGID}" ${USER}
|
||||||
|
|
||||||
|
|
||||||
echo "Adding default user to any additional required device groups"
|
print_step_header "Adding default user to any additional required device groups"
|
||||||
additional_groups=( video audio input pulse )
|
additional_groups=( video audio input pulse )
|
||||||
for group_name in "${additional_groups[@]}"; do
|
for group_name in "${additional_groups[@]}"; do
|
||||||
if [ $(getent group ${group_name:?}) ]; then
|
if [ $(getent group ${group_name:?}) ]; then
|
||||||
echo "Adding user '${USER}' to group: '${group_name}'"
|
print_step_header "Adding user '${USER}' to group: '${group_name}'"
|
||||||
usermod -aG ${group_name:?} ${USER}
|
usermod -aG ${group_name:?} ${USER}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -54,20 +54,20 @@ for dev in "${device_nodes[@]}"; do
|
|||||||
|
|
||||||
# Add group to user
|
# Add group to user
|
||||||
if [[ "${added_groups}" != *"${dev_group}"* ]]; then
|
if [[ "${added_groups}" != *"${dev_group}"* ]]; then
|
||||||
echo "Adding user '${USER}' to group: '${dev_group}' for device: ${dev}"
|
print_step_header "Adding user '${USER}' to group: '${dev_group}' for device: ${dev}"
|
||||||
usermod -aG ${dev_group} ${USER}
|
usermod -aG ${dev_group} ${USER}
|
||||||
added_groups=" ${added_groups} ${dev_group} "
|
added_groups=" ${added_groups} ${dev_group} "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo "Setting umask to ${UMASK}";
|
print_step_header "Setting umask to ${UMASK}";
|
||||||
umask ${UMASK}
|
umask ${UMASK}
|
||||||
|
|
||||||
|
|
||||||
# TODO: Move this to its own 'display' init script. It does not really belong here
|
# TODO: Move this to its own 'display' init script. It does not really belong here
|
||||||
# Configure the 'XDG_RUNTIME_DIR' path
|
# Configure the 'XDG_RUNTIME_DIR' path
|
||||||
echo "Create the user XDG_RUNTIME_DIR path '${XDG_RUNTIME_DIR}'"
|
print_step_header "Create the user XDG_RUNTIME_DIR path '${XDG_RUNTIME_DIR}'"
|
||||||
mkdir -p ${XDG_RUNTIME_DIR}
|
mkdir -p ${XDG_RUNTIME_DIR}
|
||||||
# Ensure it is owned by the 'default' user
|
# Ensure it is owned by the 'default' user
|
||||||
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}
|
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}
|
||||||
@@ -80,19 +80,19 @@ chmod a+r /etc/alternatives/desktop-background
|
|||||||
|
|
||||||
|
|
||||||
# Setup services log path
|
# Setup services log path
|
||||||
echo "Setting ownership of all log files in '${USER_HOME}/.cache/log'"
|
print_step_header "Setting ownership of all log files in '${USER_HOME}/.cache/log'"
|
||||||
mkdir -p "${USER_HOME}/.cache/log"
|
mkdir -p "${USER_HOME}/.cache/log"
|
||||||
chown -R ${PUID}:${PGID} "${USER_HOME}/.cache/log"
|
chown -R ${PUID}:${PGID} "${USER_HOME}/.cache/log"
|
||||||
|
|
||||||
|
|
||||||
# Set the root and user password
|
# Set the root and user password
|
||||||
echo "Setting root password"
|
print_step_header "Setting root password"
|
||||||
echo "root:${USER_PASSWORD}" | chpasswd
|
echo "root:${USER_PASSWORD}" | chpasswd
|
||||||
echo "Setting user password"
|
print_step_header "Setting user password"
|
||||||
echo "${USER}:${USER_PASSWORD}" | chpasswd
|
echo "${USER}:${USER_PASSWORD}" | chpasswd
|
||||||
|
|
||||||
# Set root XDG_RUNTIME_DIR path
|
# Set root XDG_RUNTIME_DIR path
|
||||||
mkdir -p /tmp/runtime-root
|
mkdir -p /tmp/runtime-root
|
||||||
chown root:root /tmp/runtime-root
|
chown root:root /tmp/runtime-root
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
@@ -1,26 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
###
|
|
||||||
# File: 11-setup_sysctl_values.sh
|
|
||||||
# Project: cont-init.d
|
|
||||||
# File Created: Friday, 1st September 2023 3:56:17 pm
|
|
||||||
# Author: Josh.5 (jsunnex@gmail.com)
|
|
||||||
# -----
|
|
||||||
# Last Modified: Monday, 1st September 2023 3:56:17 pm
|
|
||||||
# Modified By: Console and webGui login account (jsunnex@gmail.com)
|
|
||||||
###
|
|
||||||
|
|
||||||
echo "**** Configure some system kernel parameters ****"
|
# Configure kernel parameters
|
||||||
|
print_header "Configure some system kernel parameters"
|
||||||
|
|
||||||
|
|
||||||
if [ "$(cat /proc/sys/vm/max_map_count)" -ge 524288 ]; then
|
if [ "$(cat /proc/sys/vm/max_map_count)" -ge 524288 ]; then
|
||||||
if [ -w "/proc/sys/vm/max_map_count" ]; then
|
if [ -w "/proc/sys/vm/max_map_count" ]; then
|
||||||
echo "Setting the maximum number of memory map areas a process can create to 524288"
|
print_step_header "Setting the maximum number of memory map areas a process can create to 524288"
|
||||||
echo 524288 > /proc/sys/vm/max_map_count
|
echo 524288 > /proc/sys/vm/max_map_count
|
||||||
else
|
else
|
||||||
echo "WARNING: Unable to set max_map_count on unprivileged container"
|
print_warning "Unable to set vm.max_map_count on unprivileged container"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "NOTE: vm.max_map_count is already greater than '524288'"
|
print_step_header "The vm.max_map_count is already greater than '524288'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
# Configure dbus
|
# Configure dbus
|
||||||
echo "**** Configure container dbus ****";
|
print_header "Configure container dbus"
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
if [[ "${HOST_DBUS}" == "true" ]]; then
|
if [[ "${HOST_DBUS}" == "true" ]]; then
|
||||||
echo "Container configured to use the host dbus";
|
print_step_header "Container configured to use the host dbus";
|
||||||
# Disable supervisord script
|
# Disable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/dbus.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/dbus.ini
|
||||||
else
|
else
|
||||||
echo "Container configured to run its own dbus";
|
print_step_header "Container configured to run its own dbus";
|
||||||
# Enable supervisord script
|
# Enable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/dbus.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/dbus.ini
|
||||||
# Configure dbus to run as USER
|
# Configure dbus to run as USER
|
||||||
@@ -25,8 +25,8 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
|||||||
find /var/run/dbus -name "pid" -exec rm -f {} \;
|
find /var/run/dbus -name "pid" -exec rm -f {} \;
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Dbus service not available when container is run in 'secondary' mode."
|
print_step_header "Dbus service not available when container is run in 'secondary' mode."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/dbus.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/dbus.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,33 +1,26 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
###
|
# Configure dbus
|
||||||
# File: 30-configure_udev.sh
|
print_header "Configure udevd"
|
||||||
# Project: cont-init.d
|
|
||||||
# File Created: Friday, 12th January 2022 8:54:01 am
|
|
||||||
# Author: Josh.5 (jsunnex@gmail.com)
|
|
||||||
# -----
|
|
||||||
# Last Modified: Tuesday, 4th October 2022 11:20:48 am
|
|
||||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
|
||||||
###
|
|
||||||
|
|
||||||
# Since this container may also be run with CAP_SYS_ADMIN, ensure we can actually execute "udevadm trigger"
|
# Since this container may also be run with CAP_SYS_ADMIN, ensure we can actually execute "udevadm trigger"
|
||||||
run_dumb_udev="false"
|
run_dumb_udev="false"
|
||||||
if [ ! -w /sys ]; then
|
if [ ! -w /sys ]; then
|
||||||
# Disable supervisord script since we are not able to write to sysfs
|
# Disable supervisord script since we are not able to write to sysfs
|
||||||
echo "**** Disable udevd - /sys is mounted RO ****";
|
print_step_header "Disable udevd - /sys is mounted RO"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
||||||
run_dumb_udev="true"
|
run_dumb_udev="true"
|
||||||
elif [ ! -d /run/udev ]; then
|
elif [ ! -d /run/udev ]; then
|
||||||
# Disable supervisord script since we are not able to write to udev/data path
|
# Disable supervisord script since we are not able to write to udev/data path
|
||||||
echo "**** Disable udevd - /run/udev does not exist ****";
|
print_step_header "Disable udevd - /run/udev does not exist"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
||||||
run_dumb_udev="true"
|
run_dumb_udev="true"
|
||||||
elif [ ! -w /run/udev ]; then
|
elif [ ! -w /run/udev ]; then
|
||||||
# Disable supervisord script since we are not able to write to udev/data path
|
# Disable supervisord script since we are not able to write to udev/data path
|
||||||
echo "**** Disable udevd - /run/udev is mounted RO ****";
|
print_step_header "Disable udevd - /run/udev is mounted RO"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
||||||
run_dumb_udev="false"
|
run_dumb_udev="false"
|
||||||
elif udevadm trigger &> /dev/null; then
|
elif udevadm trigger &> /dev/null; then
|
||||||
echo "**** Configure container to run udev management ****";
|
print_step_header "Configure container to run udev management"
|
||||||
# Enable supervisord script
|
# Enable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
|
||||||
# Configure udev permissions
|
# Configure udev permissions
|
||||||
@@ -37,22 +30,22 @@ elif udevadm trigger &> /dev/null; then
|
|||||||
run_dumb_udev="false"
|
run_dumb_udev="false"
|
||||||
else
|
else
|
||||||
# Disable supervisord script since we are not able to execute "udevadm trigger"
|
# Disable supervisord script since we are not able to execute "udevadm trigger"
|
||||||
echo "**** Disable udev service due to privilege restrictions ****";
|
print_step_header "Disable udev service due to privilege restrictions"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
||||||
run_dumb_udev="true"
|
run_dumb_udev="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${run_dumb_udev}" = "true" ]; then
|
if [ "${run_dumb_udev}" = "true" ]; then
|
||||||
# Enable dumb-udev instead of udevd
|
# Enable dumb-udev instead of udevd
|
||||||
echo "**** Enable dumb-udev service ****";
|
print_step_header "Enable dumb-udev service"
|
||||||
sed -i 's|^command.*=.*$|command=start-dumb-udev.sh|' /etc/supervisor.d/udev.ini
|
sed -i 's|^command.*=.*$|command=start-dumb-udev.sh|' /etc/supervisor.d/udev.ini
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -e /dev/uinput ]]; then
|
if [[ -e /dev/uinput ]]; then
|
||||||
echo "**** Ensure the default user has permission to r/w on input devices ****";
|
print_step_header "Ensure the default user has permission to r/w on input devices"
|
||||||
chmod 0666 /dev/uinput
|
chmod 0666 /dev/uinput
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
|
# Configure dbus
|
||||||
|
print_header "Configure local"
|
||||||
|
|
||||||
current_local=$(head -n 1 /etc/locale.gen)
|
current_local=$(head -n 1 /etc/locale.gen)
|
||||||
user_local=$(echo ${USER_LOCALES} | cut -d ' ' -f 1)
|
user_local=$(echo ${USER_LOCALES} | cut -d ' ' -f 1)
|
||||||
|
|
||||||
if [ "${current_local}" != "${USER_LOCALES}" ]; then
|
if [ "${current_local}" != "${USER_LOCALES}" ]; then
|
||||||
echo "**** Configuring Locales to ${USER_LOCALES} ****";
|
print_step_header "Configuring Locales to ${USER_LOCALES}"
|
||||||
rm /etc/locale.gen
|
rm /etc/locale.gen
|
||||||
echo -e "${USER_LOCALES}\nen_US.UTF-8 UTF-8" > "/etc/locale.gen"
|
echo -e "${USER_LOCALES}\nen_US.UTF-8 UTF-8" > "/etc/locale.gen"
|
||||||
export LANGUAGE="${user_local}"
|
export LANGUAGE="${user_local}"
|
||||||
@@ -13,7 +16,7 @@ if [ "${current_local}" != "${USER_LOCALES}" ]; then
|
|||||||
locale-gen
|
locale-gen
|
||||||
update-locale LC_ALL="${user_local}"
|
update-locale LC_ALL="${user_local}"
|
||||||
else
|
else
|
||||||
echo "**** Locales already set correctly to ${USER_LOCALES} ****";
|
print_step_header "Locales already set correctly to ${USER_LOCALES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
|
|
||||||
echo "**** Configure pulseaudio ****"
|
# Configure dbus
|
||||||
|
print_header "Configure pulseaudio"
|
||||||
|
|
||||||
# Always enable the pulseaudio service
|
# Always enable the pulseaudio service
|
||||||
echo "Enable pulseaudio service."
|
print_step_header "Enable pulseaudio service."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/pulseaudio.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/pulseaudio.ini
|
||||||
|
|
||||||
if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
|
if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
|
||||||
echo "Configure pulseaudio as simple dummy audio"
|
print_step_header "Configure pulseaudio as simple dummy audio"
|
||||||
sed -i 's|^; autospawn.*$|autospawn = no|' /etc/pulse/client.conf
|
sed -i 's|^; autospawn.*$|autospawn = no|' /etc/pulse/client.conf
|
||||||
sed -i 's|^; daemon-binary.*$|daemon-binary = /bin/true|' /etc/pulse/client.conf
|
sed -i 's|^; daemon-binary.*$|daemon-binary = /bin/true|' /etc/pulse/client.conf
|
||||||
|
|
||||||
sed -i 's|^; flat-volumes.*$|flat-volumes = yes|' /etc/pulse/daemon.conf
|
sed -i 's|^; flat-volumes.*$|flat-volumes = yes|' /etc/pulse/daemon.conf
|
||||||
else
|
else
|
||||||
echo "Configure pulseaudio to pipe audio to a socket"
|
print_step_header "Configure pulseaudio to pipe audio to a socket"
|
||||||
|
|
||||||
# Ensure pulseaudio directories have the correct permissions
|
# Ensure pulseaudio directories have the correct permissions
|
||||||
mkdir -p \
|
mkdir -p \
|
||||||
@@ -37,4 +38,4 @@ else
|
|||||||
fi
|
fi
|
||||||
chown -R ${USER} /etc/pulse
|
chown -R ${USER} /etc/pulse
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ function download_driver {
|
|||||||
chown -R ${USER:?} "${USER_HOME:?}/Downloads"
|
chown -R ${USER:?} "${USER_HOME:?}/Downloads"
|
||||||
|
|
||||||
if [[ ! -f "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" ]]; then
|
if [[ ! -f "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" ]]; then
|
||||||
echo "Downloading driver v${nvidia_host_driver_version:?}"
|
print_step_header "Downloading driver v${nvidia_host_driver_version:?}"
|
||||||
wget -q --show-progress --progress=bar:force:noscroll \
|
wget -q --show-progress --progress=bar:force:noscroll \
|
||||||
-O /tmp/NVIDIA.run \
|
-O /tmp/NVIDIA.run \
|
||||||
"http://download.nvidia.com/XFree86/Linux-x86_64/${nvidia_host_driver_version:?}/NVIDIA-Linux-x86_64-${nvidia_host_driver_version:?}.run"
|
"http://download.nvidia.com/XFree86/Linux-x86_64/${nvidia_host_driver_version:?}/NVIDIA-Linux-x86_64-${nvidia_host_driver_version:?}.run"
|
||||||
[[ $? -gt 0 ]] && echo "Error downloading driver. Exit!" && return 1
|
[[ $? -gt 0 ]] && print_error "Unable to download driver. Exit!" && return 1
|
||||||
|
|
||||||
mv /tmp/NVIDIA.run "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
mv /tmp/NVIDIA.run "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
||||||
fi
|
fi
|
||||||
@@ -52,7 +52,7 @@ function install_nvidia_driver {
|
|||||||
download_driver
|
download_driver
|
||||||
|
|
||||||
if (($(echo $nvidia_host_driver_version | cut -d '.' -f 1) > 500)); then
|
if (($(echo $nvidia_host_driver_version | cut -d '.' -f 1) > 500)); then
|
||||||
echo "Installing NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
print_step_header "Installing NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
||||||
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
||||||
"${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" \
|
"${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" \
|
||||||
--silent \
|
--silent \
|
||||||
@@ -73,7 +73,7 @@ function install_nvidia_driver {
|
|||||||
--no-install-libglvnd \
|
--no-install-libglvnd \
|
||||||
> "${USER_HOME:?}/Downloads/nvidia_gpu_install.log" 2>&1
|
> "${USER_HOME:?}/Downloads/nvidia_gpu_install.log" 2>&1
|
||||||
else
|
else
|
||||||
echo "Installing Legacy NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
print_step_header "Installing Legacy NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
||||||
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
||||||
"${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" \
|
"${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" \
|
||||||
--silent \
|
--silent \
|
||||||
@@ -104,13 +104,13 @@ function patch_nvidia_driver {
|
|||||||
(
|
(
|
||||||
set +e
|
set +e
|
||||||
if [ ! -f "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" ]; then
|
if [ ! -f "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" ]; then
|
||||||
echo "Fetch NVIDIA NVENC patch"
|
print_step_header "Fetch NVIDIA NVENC patch"
|
||||||
wget -q --show-progress --progress=bar:force:noscroll \
|
wget -q --show-progress --progress=bar:force:noscroll \
|
||||||
-O "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" \
|
-O "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" \
|
||||||
"https://raw.githubusercontent.com/keylase/nvidia-patch/${NVIDIA_PATCH_VERSION:?}/patch.sh"
|
"https://raw.githubusercontent.com/keylase/nvidia-patch/${NVIDIA_PATCH_VERSION:?}/patch.sh"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh" ]; then
|
if [ ! -f "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh" ]; then
|
||||||
echo "Fetch NVIDIA NvFBC patch"
|
print_step_header "Fetch NVIDIA NvFBC patch"
|
||||||
wget -q --show-progress --progress=bar:force:noscroll \
|
wget -q --show-progress --progress=bar:force:noscroll \
|
||||||
-O "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh" \
|
-O "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh" \
|
||||||
"https://raw.githubusercontent.com/keylase/nvidia-patch/${NVIDIA_PATCH_VERSION:?}/patch-fbc.sh"
|
"https://raw.githubusercontent.com/keylase/nvidia-patch/${NVIDIA_PATCH_VERSION:?}/patch-fbc.sh"
|
||||||
@@ -119,13 +119,13 @@ function patch_nvidia_driver {
|
|||||||
"${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" \
|
"${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh" \
|
||||||
"${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh"
|
"${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh"
|
||||||
|
|
||||||
echo "Install NVIDIA driver patches"
|
print_step_header "Install NVIDIA driver patches"
|
||||||
echo "/patched-lib" > /etc/ld.so.conf.d/000-patched-lib.conf
|
echo "/patched-lib" > /etc/ld.so.conf.d/000-patched-lib.conf
|
||||||
mkdir -p "/patched-lib"
|
mkdir -p "/patched-lib"
|
||||||
PATCH_OUTPUT_DIR="/patched-lib" "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh"
|
PATCH_OUTPUT_DIR="/patched-lib" "${USER_HOME:?}/Downloads/nvidia-patch.${NVIDIA_PATCH_VERSION:?}.sh"
|
||||||
PATCH_OUTPUT_DIR="/patched-lib" "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh"
|
PATCH_OUTPUT_DIR="/patched-lib" "${USER_HOME:?}/Downloads/nvidia-patch-fbc.${NVIDIA_PATCH_VERSION:?}.sh"
|
||||||
|
|
||||||
pushd "/patched-lib" &> /dev/null || { echo "Error: Failed to push directory to /patched-lib"; exit 1; }
|
pushd "/patched-lib" &> /dev/null || { print_error "Failed to push directory to /patched-lib"; exit 1; }
|
||||||
for f in * ; do
|
for f in * ; do
|
||||||
suffix="${f##*.so}"
|
suffix="${f##*.so}"
|
||||||
name="$(basename "$f" "$suffix")"
|
name="$(basename "$f" "$suffix")"
|
||||||
@@ -133,21 +133,21 @@ function patch_nvidia_driver {
|
|||||||
[ -h "$name" ] || ln -sf "$f" "$name.1"
|
[ -h "$name" ] || ln -sf "$f" "$name.1"
|
||||||
done
|
done
|
||||||
ldconfig
|
ldconfig
|
||||||
popd &> /dev/null || { echo "Error: Failed to pop directory out of /patched-lib"; exit 1; }
|
popd &> /dev/null || { print_error "Failed to pop directory out of /patched-lib"; exit 1; }
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
echo "Leaving NVIDIA driver stock without patching"
|
print_step_header "Leaving NVIDIA driver stock without patching"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_deb_mesa {
|
function install_deb_mesa {
|
||||||
if [ ! -f /tmp/init-mesa-libs-install.log ]; then
|
if [ ! -f /tmp/init-mesa-libs-install.log ]; then
|
||||||
echo " - Enable i386 arch"
|
print_step_header "Enable i386 arch"
|
||||||
dpkg --add-architecture i386
|
dpkg --add-architecture i386
|
||||||
echo " - Add Debian SID sources"
|
print_step_header "Add Debian SID sources"
|
||||||
echo "deb http://deb.debian.org/debian/ sid main" > /etc/apt/sources.list
|
echo "deb http://deb.debian.org/debian/ sid main" > /etc/apt/sources.list
|
||||||
apt-get update &>> /tmp/init-mesa-libs-install.log
|
apt-get update &>> /tmp/init-mesa-libs-install.log
|
||||||
echo " - Install mesa vulkan drivers"
|
print_step_header "Install mesa vulkan drivers"
|
||||||
echo "" >> /tmp/init-mesa-libs-install.log
|
echo "" >> /tmp/init-mesa-libs-install.log
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
libvulkan1 \
|
libvulkan1 \
|
||||||
@@ -159,13 +159,13 @@ function install_deb_mesa {
|
|||||||
vulkan-tools \
|
vulkan-tools \
|
||||||
&>> /tmp/init-mesa-libs-install.log
|
&>> /tmp/init-mesa-libs-install.log
|
||||||
else
|
else
|
||||||
echo " - Mesa has already been installed into this container"
|
print_step_header "Mesa has already been installed into this container"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_amd_gpu_driver {
|
function install_amd_gpu_driver {
|
||||||
echo "Install AMD Mesa driver"
|
|
||||||
if command -v pacman &> /dev/null; then
|
if command -v pacman &> /dev/null; then
|
||||||
|
print_step_header "Install AMD Mesa driver"
|
||||||
pacman -Syu --noconfirm --needed \
|
pacman -Syu --noconfirm --needed \
|
||||||
lib32-vulkan-icd-loader \
|
lib32-vulkan-icd-loader \
|
||||||
lib32-vulkan-radeon \
|
lib32-vulkan-radeon \
|
||||||
@@ -177,8 +177,8 @@ function install_amd_gpu_driver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function install_intel_gpu_driver {
|
function install_intel_gpu_driver {
|
||||||
echo "Install Intel Mesa driver"
|
|
||||||
if command -v pacman &> /dev/null; then
|
if command -v pacman &> /dev/null; then
|
||||||
|
print_step_header "Install Intel Mesa driver"
|
||||||
pacman -Syu --noconfirm --needed \
|
pacman -Syu --noconfirm --needed \
|
||||||
lib32-vulkan-icd-loader \
|
lib32-vulkan-icd-loader \
|
||||||
lib32-vulkan-intel \
|
lib32-vulkan-intel \
|
||||||
@@ -191,28 +191,28 @@ function install_intel_gpu_driver {
|
|||||||
|
|
||||||
# Intel Arc GPU or Intel CPU with possible iGPU
|
# Intel Arc GPU or Intel CPU with possible iGPU
|
||||||
if [ "${intel_gpu_model:-}X" != "X" ]; then
|
if [ "${intel_gpu_model:-}X" != "X" ]; then
|
||||||
echo "**** Found Intel device '${intel_gpu_model:?}' ****"
|
print_header "Found Intel device '${intel_gpu_model:?}'"
|
||||||
install_intel_gpu_driver
|
install_intel_gpu_driver
|
||||||
elif [ "${intel_cpu_model:-}X" != "X" ]; then
|
elif [ "${intel_cpu_model:-}X" != "X" ]; then
|
||||||
echo "**** Found Intel device '${intel_cpu_model:?}' ****"
|
print_header "Found Intel device '${intel_cpu_model:?}'"
|
||||||
install_intel_gpu_driver
|
install_intel_gpu_driver
|
||||||
else
|
else
|
||||||
echo "**** No Intel device found ****"
|
print_header "No Intel device found"
|
||||||
fi
|
fi
|
||||||
# AMD GPU
|
# AMD GPU
|
||||||
if [ "${amd_gpu_model:-}X" != "X" ]; then
|
if [ "${amd_gpu_model:-}X" != "X" ]; then
|
||||||
echo "**** Found AMD device '${amd_gpu_model:?}' ****"
|
print_header "Found AMD device '${amd_gpu_model:?}'"
|
||||||
install_amd_gpu_driver
|
install_amd_gpu_driver
|
||||||
else
|
else
|
||||||
echo "**** No AMD device found ****"
|
print_header "No AMD device found"
|
||||||
fi
|
fi
|
||||||
# NVIDIA GPU
|
# NVIDIA GPU
|
||||||
if [ "${nvidia_pci_address:-}X" != "X" ]; then
|
if [ "${nvidia_pci_address:-}X" != "X" ]; then
|
||||||
echo "**** Found NVIDIA device '${nvidia_gpu_name:?}' ****"
|
print_header "Found NVIDIA device '${nvidia_gpu_name:?}'"
|
||||||
install_nvidia_driver
|
install_nvidia_driver
|
||||||
patch_nvidia_driver
|
patch_nvidia_driver
|
||||||
else
|
else
|
||||||
echo "**** No NVIDIA device found ****"
|
print_header "No NVIDIA device found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
|
|
||||||
echo "**** Configure Desktop ****"
|
print_header "Configure Desktop"
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
echo "Enable Desktop service."
|
print_step_header "Enable Desktop service."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/desktop.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/desktop.ini
|
||||||
else
|
else
|
||||||
echo "Desktop service not available when container is run in 'secondary' mode."
|
print_step_header "Desktop service not available when container is run in 'secondary' mode."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/desktop.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/desktop.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup home directory
|
# Setup home directory
|
||||||
if [[ ! -f /tmp/.home-directory-template-updated ]]; then
|
if [[ ! -f /tmp/.home-directory-template-updated ]]; then
|
||||||
echo "Ensure home directory template is owned by the default user."
|
print_step_header "Ensure home directory template is owned by the default user."
|
||||||
chown -R ${PUID}:${PGID} /templates/home_directory_template
|
chown -R ${PUID}:${PGID} /templates/home_directory_template
|
||||||
echo "Installing default home directory template"
|
print_step_header "Installing default home directory template"
|
||||||
mkdir -p "${USER_HOME:?}"
|
mkdir -p "${USER_HOME:?}"
|
||||||
rsync -aq /templates/home_directory_template/ "${USER_HOME:?}"/
|
rsync -aq /templates/home_directory_template/ "${USER_HOME:?}"/
|
||||||
touch /tmp/.home-directory-template-updated
|
touch /tmp/.home-directory-template-updated
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ fi
|
|||||||
|
|
||||||
# Configure a NVIDIA X11 config
|
# Configure a NVIDIA X11 config
|
||||||
function configure_nvidia_x_server {
|
function configure_nvidia_x_server {
|
||||||
echo "Configuring X11 with GPU ID: '${gpu_select}'"
|
print_step_header "Configuring X11 with GPU ID: '${gpu_select}'"
|
||||||
nvidia_gpu_hex_id=$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select}" 2> /dev/null | sed -n 2p)
|
nvidia_gpu_hex_id=$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select}" 2> /dev/null | sed -n 2p)
|
||||||
IFS=":." ARR_ID=(${nvidia_gpu_hex_id})
|
IFS=":." ARR_ID=(${nvidia_gpu_hex_id})
|
||||||
unset IFS
|
unset IFS
|
||||||
bus_id=PCI:$((16#${ARR_ID[1]})):$((16#${ARR_ID[2]})):$((16#${ARR_ID[3]}))
|
bus_id=PCI:$((16#${ARR_ID[1]})):$((16#${ARR_ID[2]})):$((16#${ARR_ID[3]}))
|
||||||
echo "Configuring X11 with PCI bus ID: '${bus_id}'"
|
print_step_header "Configuring X11 with PCI bus ID: '${bus_id}'"
|
||||||
export MODELINE=$(cvt -r "${DISPLAY_SIZEW}" "${DISPLAY_SIZEH}" "${DISPLAY_REFRESH}" | sed -n 2p)
|
export MODELINE=$(cvt -r "${DISPLAY_SIZEW}" "${DISPLAY_SIZEH}" "${DISPLAY_REFRESH}" | sed -n 2p)
|
||||||
echo "Writing X11 config with ${MODELINE}"
|
print_step_header "Writing X11 config with ${MODELINE}"
|
||||||
connected_monitor="--use-display-device=None"
|
connected_monitor="--use-display-device=None"
|
||||||
if [[ "X${DISPLAY_VIDEO_PORT:-}" != "X" ]]; then
|
if [[ "X${DISPLAY_VIDEO_PORT:-}" != "X" ]]; then
|
||||||
connected_monitor="--connected-monitor=${DISPLAY_VIDEO_PORT:?}"
|
connected_monitor="--connected-monitor=${DISPLAY_VIDEO_PORT:?}"
|
||||||
@@ -55,11 +55,11 @@ function configure_nvidia_x_server {
|
|||||||
function configure_x_server {
|
function configure_x_server {
|
||||||
# Configure x to be run by anyone
|
# Configure x to be run by anyone
|
||||||
if [[ ! -f /etc/X11/Xwrapper.config ]]; then
|
if [[ ! -f /etc/X11/Xwrapper.config ]]; then
|
||||||
echo "Create Xwrapper.config"
|
print_step_header "Create Xwrapper.config"
|
||||||
echo 'allowed_users=anybody' > /etc/X11/Xwrapper.config
|
echo 'allowed_users=anybody' > /etc/X11/Xwrapper.config
|
||||||
echo 'needs_root_rights=yes' >> /etc/X11/Xwrapper.config
|
echo 'needs_root_rights=yes' >> /etc/X11/Xwrapper.config
|
||||||
elif grep -Fxq "allowed_users=console" /etc/X11/Xwrapper.config; then
|
elif grep -Fxq "allowed_users=console" /etc/X11/Xwrapper.config; then
|
||||||
echo "Configure Xwrapper.config"
|
print_step_header "Configure Xwrapper.config"
|
||||||
sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
|
sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
|
||||||
echo 'needs_root_rights=yes' >> /etc/X11/Xwrapper.config
|
echo 'needs_root_rights=yes' >> /etc/X11/Xwrapper.config
|
||||||
fi
|
fi
|
||||||
@@ -73,7 +73,7 @@ function configure_x_server {
|
|||||||
# Clear out old lock files
|
# Clear out old lock files
|
||||||
display_file=${XORG_SOCKET_DIR}/X${DISPLAY#:}
|
display_file=${XORG_SOCKET_DIR}/X${DISPLAY#:}
|
||||||
if [ -S ${display_file} ]; then
|
if [ -S ${display_file} ]; then
|
||||||
echo "Removing ${display_file} before starting"
|
print_step_header "Removing ${display_file} before starting"
|
||||||
rm -f /tmp/.X${DISPLAY#:}-lock
|
rm -f /tmp/.X${DISPLAY#:}-lock
|
||||||
rm ${display_file}
|
rm ${display_file}
|
||||||
fi
|
fi
|
||||||
@@ -85,31 +85,31 @@ function configure_x_server {
|
|||||||
|
|
||||||
# Check if this container is being run as a secondary instance
|
# Check if this container is being run as a secondary instance
|
||||||
if ([ "${MODE}" = "p" ] || [ "${MODE}" = "primary" ]); then
|
if ([ "${MODE}" = "p" ] || [ "${MODE}" = "primary" ]); then
|
||||||
echo "Configure container as primary the X server"
|
print_step_header "Configure container as primary the X server"
|
||||||
# Enable supervisord script
|
# Enable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xorg.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xorg.ini
|
||||||
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
|
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
|
||||||
echo "Configure container to use a virtual framebuffer as the X server"
|
print_step_header "Configure container to use a virtual framebuffer as the X server"
|
||||||
# Disable xorg supervisord script
|
# Disable xorg supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
||||||
# Enable xvfb supervisord script
|
# Enable xvfb supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xvfb.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xvfb.ini
|
||||||
else
|
else
|
||||||
echo "Configure container with no X server"
|
print_step_header "Configure container with no X server"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable KB/Mouse input capture with Xorg if configured
|
# Enable KB/Mouse input capture with Xorg if configured
|
||||||
if [ ${ENABLE_EVDEV_INPUTS:-} = "true" ]; then
|
if [ ${ENABLE_EVDEV_INPUTS:-} = "true" ]; then
|
||||||
echo "Enabling evdev input class on pointers, keyboards, touchpads, touch screens, etc."
|
print_step_header "Enabling evdev input class on pointers, keyboards, touchpads, touch screens, etc."
|
||||||
cp -fv /usr/share/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/10-evdev.conf
|
cp -fv /usr/share/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/10-evdev.conf
|
||||||
else
|
else
|
||||||
echo "Leaving evdev inputs disabled"
|
print_step_header "Leaving evdev inputs disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure dummy config if no monitor is connected (not applicable to NVIDIA)
|
# Configure dummy config if no monitor is connected (not applicable to NVIDIA)
|
||||||
if ([ "X${monitor_connected}" = "X" ] || [ "${FORCE_X11_DUMMY_CONFIG}" = "true" ]); then
|
if ([ "X${monitor_connected}" = "X" ] || [ "${FORCE_X11_DUMMY_CONFIG}" = "true" ]); then
|
||||||
echo "No monitors connected. Installing dummy xorg.conf"
|
print_step_header "No monitors connected. Installing dummy xorg.conf"
|
||||||
# Use a dummy display input
|
# Use a dummy display input
|
||||||
cp -fv /templates/xorg/xorg.dummy.conf /etc/X11/xorg.conf
|
cp -fv /templates/xorg/xorg.dummy.conf /etc/X11/xorg.conf
|
||||||
fi
|
fi
|
||||||
@@ -117,13 +117,13 @@ function configure_x_server {
|
|||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
if [[ -z ${nvidia_gpu_hex_id} ]]; then
|
if [[ -z ${nvidia_gpu_hex_id} ]]; then
|
||||||
echo "**** Generate default xorg.conf ****";
|
print_header "Generate default xorg.conf"
|
||||||
configure_x_server
|
configure_x_server
|
||||||
else
|
else
|
||||||
echo "**** Generate NVIDIA xorg.conf ****";
|
print_header "Generate NVIDIA xorg.conf"
|
||||||
configure_x_server
|
configure_x_server
|
||||||
configure_nvidia_x_server
|
configure_nvidia_x_server
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
echo "**** Configure Flatpak ****"
|
print_header "Configure Flatpak"
|
||||||
|
|
||||||
if [ "X${NVIDIA_VISIBLE_DEVICES:-}" != "X" ]; then
|
if [ "X${NVIDIA_VISIBLE_DEVICES:-}" != "X" ]; then
|
||||||
# Fix some flatpak quirks (not sure what is happening here) for NVIDIA containers
|
# Fix some flatpak quirks (not sure what is happening here) for NVIDIA containers
|
||||||
mount -t proc none /proc
|
mount -t proc none /proc
|
||||||
flatpak list
|
flatpak list
|
||||||
echo "Flatpak configured for running inside a Docker container"
|
print_step_header "Flatpak configured for running inside a Docker container"
|
||||||
else
|
else
|
||||||
echo "Flatpak already configured for running inside a Docker container"
|
print_step_header "Flatpak already configured for running inside a Docker container"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
echo "**** Configure Neko ****"
|
print_header "Configure Neko"
|
||||||
# REF: https://neko.m1k1o.net/#/getting-started/configuration
|
# REF: https://neko.m1k1o.net/#/getting-started/configuration
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
if [ ${WEB_UI_MODE} = "neko" ]; then
|
if [ ${WEB_UI_MODE} = "neko" ]; then
|
||||||
echo "Enable Neko server"
|
print_step_header "Enable Neko server"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/neko.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/neko.ini
|
||||||
|
|
||||||
# Make directories for neko
|
# Make directories for neko
|
||||||
@@ -15,9 +15,9 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
|||||||
# Configure nat1to1 if it is not already set
|
# Configure nat1to1 if it is not already set
|
||||||
if [[ -z ${NEKO_NAT1TO1} ]]; then
|
if [[ -z ${NEKO_NAT1TO1} ]]; then
|
||||||
export NEKO_NAT1TO1=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
export NEKO_NAT1TO1=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||||
echo "Setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
|
print_step_header "Setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
|
||||||
else
|
else
|
||||||
echo "User provided setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
|
print_step_header "User provided setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure hardware acceleration if it is not already set
|
# Configure hardware acceleration if it is not already set
|
||||||
@@ -39,10 +39,10 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
|||||||
export NEKO_SCREEN="${DISPLAY_SIZEW}x${DISPLAY_SIZEH}@${DISPLAY_REFRESH}"
|
export NEKO_SCREEN="${DISPLAY_SIZEW}x${DISPLAY_SIZEH}@${DISPLAY_REFRESH}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Disable Neko server"
|
print_step_header "Disable Neko server"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Neko server not available when container is run in 'secondary' mode"
|
print_step_header "Neko server not available when container is run in 'secondary' mode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
echo "**** Configure Steam ****"
|
print_header "Configure Steam"
|
||||||
|
|
||||||
steam_autostart_desktop="$(cat <<EOF
|
steam_autostart_desktop="$(cat <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
@@ -19,17 +19,17 @@ EOF
|
|||||||
|
|
||||||
if [ "${ENABLE_STEAM:-}" = "true" ]; then
|
if [ "${ENABLE_STEAM:-}" = "true" ]; then
|
||||||
if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
|
if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
|
||||||
echo "Enable Steam supervisor.d service"
|
print_step_header "Enable Steam supervisor.d service"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/steam.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/steam.ini
|
||||||
else
|
else
|
||||||
echo "Enable Steam auto-start script"
|
print_step_header "Enable Steam auto-start script"
|
||||||
mkdir -p "${USER_HOME:?}/.config/autostart"
|
mkdir -p "${USER_HOME:?}/.config/autostart"
|
||||||
echo "${steam_autostart_desktop:?}" > "${USER_HOME:?}/.config/autostart/Steam.desktop"
|
echo "${steam_autostart_desktop:?}" > "${USER_HOME:?}/.config/autostart/Steam.desktop"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Disable Steam service"
|
print_step_header "Disable Steam service"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
echo "**** Configure Sunshine ****"
|
print_header "Configure Sunshine"
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
if [ "${ENABLE_SUNSHINE:-}" = "true" ]; then
|
if [ "${ENABLE_SUNSHINE:-}" = "true" ]; then
|
||||||
echo "Enable Sunshine server"
|
print_step_header "Enable Sunshine server"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/sunshine.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/sunshine.ini
|
||||||
else
|
else
|
||||||
echo "Disable Sunshine server"
|
print_step_header "Disable Sunshine server"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Sunshine server not available when container is run in 'secondary' mode"
|
print_step_header "Sunshine server not available when container is run in 'secondary' mode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
echo "**** Configure VNC ****"
|
print_header "Configure VNC"
|
||||||
|
|
||||||
function get_next_unused_port() {
|
function get_next_unused_port() {
|
||||||
local __start_port=${1}
|
local __start_port=${1}
|
||||||
@@ -16,15 +16,15 @@ function get_next_unused_port() {
|
|||||||
# REF: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=130
|
# REF: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=130
|
||||||
DYNAMIC_PORT_VNC=$(get_next_unused_port 32035)
|
DYNAMIC_PORT_VNC=$(get_next_unused_port 32035)
|
||||||
export PORT_VNC=${PORT_VNC:-$DYNAMIC_PORT_VNC}
|
export PORT_VNC=${PORT_VNC:-$DYNAMIC_PORT_VNC}
|
||||||
echo "Configure VNC service port '${PORT_VNC}'"
|
print_step_header "Configure VNC service port '${PORT_VNC}'"
|
||||||
DYNAMIC_PORT_AUDIO_STREAM=$(get_next_unused_port ${DYNAMIC_PORT_VNC})
|
DYNAMIC_PORT_AUDIO_STREAM=$(get_next_unused_port ${DYNAMIC_PORT_VNC})
|
||||||
export PORT_AUDIO_STREAM=${PORT_AUDIO_STREAM:-$DYNAMIC_PORT_AUDIO_STREAM}
|
export PORT_AUDIO_STREAM=${PORT_AUDIO_STREAM:-$DYNAMIC_PORT_AUDIO_STREAM}
|
||||||
echo "Configure pulseaudio encoded stream port '${PORT_AUDIO_STREAM}'"
|
print_step_header "Configure pulseaudio encoded stream port '${PORT_AUDIO_STREAM}'"
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
|
|
||||||
if [ "${WEB_UI_MODE:-}" = "vnc" ]; then
|
if [ "${WEB_UI_MODE:-}" = "vnc" ]; then
|
||||||
echo "Enable VNC server"
|
print_step_header "Enable VNC server"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc.ini
|
||||||
|
|
||||||
# TODO: Remove this... Always enable VNC audio
|
# TODO: Remove this... Always enable VNC audio
|
||||||
@@ -32,20 +32,20 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
|||||||
# Enable supervisord script
|
# Enable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc-audio.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc-audio.ini
|
||||||
else
|
else
|
||||||
echo "Disable audio stream"
|
print_step_header "Disable audio stream"
|
||||||
echo "Disable audio websock"
|
print_step_header "Disable audio websock"
|
||||||
# Disable supervisord script
|
# Disable supervisord script
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Disable VNC server"
|
print_step_header "Disable VNC server"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc.ini
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "VNC server not available when container is run in 'secondary' mode"
|
print_step_header "VNC server not available when container is run in 'secondary' mode"
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc.ini
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DONE"
|
echo -e "\e[34mDONE\e[0m"
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||||
###
|
###
|
||||||
|
|
||||||
echo "**** Configure WoL Manager ****"
|
print_header "Configure WoL Manager"
|
||||||
|
|
||||||
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
if [ "${ENABLE_WOL_POWER_MANAGER:-}" = "true" ]; then
|
if [ "${ENABLE_WOL_POWER_MANAGER:-}" = "true" ]; then
|
||||||
if [ -f "/tmp/.wol-monitor" ]; then
|
if [ -f "/tmp/.wol-monitor" ]; then
|
||||||
echo "Container started in WoL Manager mode. Disabling all other services."
|
print_step_header "Container started in WoL Manager mode. Disabling all other services."
|
||||||
for init_config in /etc/supervisor.d/*.ini ; do
|
for init_config in /etc/supervisor.d/*.ini ; do
|
||||||
init_config_basename=$(basename "${init_config:?}")
|
init_config_basename=$(basename "${init_config:?}")
|
||||||
init_name="${init_config_basename%.*}"
|
init_name="${init_config_basename%.*}"
|
||||||
@@ -23,12 +23,12 @@ if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
|||||||
sed -i 's|^autostart.*=.*$|autostart=false|' "${init_config:?}"
|
sed -i 's|^autostart.*=.*$|autostart=false|' "${init_config:?}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
echo "Enable WoL Manager service."
|
print_step_header "Enable WoL Manager service."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/wol-power-manager.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/wol-power-manager.ini
|
||||||
else
|
else
|
||||||
echo "Disable WoL Manager service."
|
print_step_header "Disable WoL Manager service."
|
||||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/wol-power-manager.ini
|
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/wol-power-manager.ini
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "WoL Manager service not available when container is run in 'secondary' mode."
|
print_step_header "WoL Manager service not available when container is run in 'secondary' mode."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user