Improvements to the init process

Move some files to locations that make more sense...
Downloads go to Downloads
Init scripts go to an "init" directory
Add a script for clearing up some memory - May or may not use it.
This commit is contained in:
Josh.5
2022-01-12 20:53:55 +13:00
parent 1ba89a9bc8
commit 0008e05848
9 changed files with 26 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
###
# File: entrypoint.sh
# Project: docker-steamos
# Project: docker-steam-headless
# File Created: Saturday, 8th January 2022 7:08:46 pm
# Author: Josh.5 (jsunnex@gmail.com)
# -----
@@ -17,8 +17,8 @@ if [ ! -z "$@" ]; then
exit $?
fi
# Execute all init scripts
for init_script in /scripts/*.sh ; do
# Execute all container init scripts
for init_script in /etc/cont-init.d/*.sh ; do
echo
echo "[ ${init_script}: executing... ]"
sed -i 's/\r$//' "${init_script}"

View File

@@ -16,16 +16,17 @@ export nvidia_gpu_name=$(nvidia-smi --format=csv --query-gpu=name --id="${gpu_se
export nvidia_host_driver_version="$(nvidia-smi 2> /dev/null | grep NVIDIA-SMI | cut -d ' ' -f3)"
function download_driver {
mkdir -p ${USER_HOME}/.cache/nvidia
mkdir -p ${USER_HOME}/Downloads
chown -R ${USER} ${USER_HOME}/Downloads
if [[ ! -f "${USER_HOME}/.cache/nvidia/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}"
wget -q --show-progress --progress=bar:force:noscroll \
-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
[[ $? -gt 0 ]] && echo "Error downloading driver. Exit!" && return 1
mv /tmp/NVIDIA.run ${USER_HOME}/.cache/nvidia/NVIDIA_${nvidia_host_driver_version}.run
mv /tmp/NVIDIA.run ${USER_HOME}/Downloads/NVIDIA_${nvidia_host_driver_version}.run
fi
}
@@ -38,8 +39,8 @@ function install_driver {
download_driver
echo "Installing driver v${nvidia_host_driver_version} to match what is running on the host"
chmod +x ${USER_HOME}/.cache/nvidia/NVIDIA_${nvidia_host_driver_version}.run
${USER_HOME}/.cache/nvidia/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 \
--silent \
--accept-license \
--no-kernel-module \
@@ -51,7 +52,7 @@ function install_driver {
--no-check-for-alternate-installs \
--no-libglx-indirect \
--no-install-libglvnd \
> ${USER_HOME}/.cache/nvidia/last_install.log 2>&1
> ${USER_HOME}/Downloads/nvidia_gpu_install.log 2>&1
}
if [[ -z ${nvidia_pci_address} ]]; then

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
###
# File: drop_caches.sh
# Project: docker-steam-headless
# File Created: Wednesday, 12th January 2022 5:08:46 pm
# Author: Josh.5 (jsunnex@gmail.com)
# -----
# Last Modified: Wednesday, 12th January 2022 5:44:17 pm
# Modified By: Josh.5 (jsunnex@gmail.com)
###
# Clear out the memory page cache
echo 1 > /proc/sys/vm/drop_caches
# Flush any FS buffers
sync