Some minor tweaks and improvments

This commit is contained in:
Josh.5
2022-10-07 03:46:52 +13:00
parent f233991597
commit 477e25f82c
7 changed files with 77 additions and 32 deletions

View File

@@ -57,9 +57,7 @@ echo "Setting umask to ${UMASK}";
umask ${UMASK}
# Configure the 'XDG_RUNTIME_DIR' to something that is easily shared between containers
export XDG_RUNTIME_DIR=/tmp/.X11-unix/run
# export XDG_RUNTIME_DIR=/run/user/${PUID}
# Configure the 'XDG_RUNTIME_DIR' path
echo "Create the user XDG_RUNTIME_DIR path '${XDG_RUNTIME_DIR}'"
mkdir -p ${XDG_RUNTIME_DIR}
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}

View File

@@ -51,7 +51,7 @@ min_log_level = info
# upnp = on
# The file where current state of Sunshine is stored
file_state = /home/default/sunshine_state.json
# file_state = sunshine_state.json
# The file where user credentials for the UI are stored
# By default, credentials are stored in `file_state`

View File

@@ -23,3 +23,19 @@ wait_for_x() {
fi
done
}
get_nvidia_gpu_id() {
# Fech NVIDIA GPU device (if one exists)
if [ "${NVIDIA_VISIBLE_DEVICES:-}" == "all" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
elif [ -z "${NVIDIA_VISIBLE_DEVICES:-}" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
else
gpu_select=$(nvidia-smi --format=csv --id=$(echo "${NVIDIA_VISIBLE_DEVICES:-}" | cut -d ',' -f1) --query-gpu=uuid | sed -n 2p)
if [ -z "$gpu_select" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
fi
fi
echo ${gpu_select}
}

View File

@@ -19,8 +19,6 @@ trap _term SIGTERM SIGINT
# CONFIGURE:
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-:/tmp/.X11-unix/run}
#XAUTHORITY=${XDG_RUNTIME_DIR:-/home/${USER}/.xauthority}
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
export $(dbus-launch)

View File

@@ -24,8 +24,18 @@ mkdir -p /home/${USER}/sunshine
if [[ ! -f /home/${USER}/sunshine/sunshine.conf ]]; then
cp -vf /templates/sunshine/* /home/${USER}/sunshine/
# TODO: Set the default encoder '# encoder = nvenc'
# TODO: Enable the vaapi device if not using nvenc
# vainfo --display drm --device /dev/dri/renderD128 2> /dev/null | grep -E "((VAProfileH264High|VAProfileHEVCMain|VAProfileHEVCMain10).*VAEntrypointEncSlice)"
# nvidia_gpu_id=$(get_nvidia_gpu_id)
# if [[ "X${nvidia_gpu_id:-}" != "X" ]]; then
# if [[ "all video" == *"${NVIDIA_DRIVER_CAPABILITIES}"* ]]; then
# # Check if we have a nvidia GPU available
# sed -i 's|^# encoder.*=.*$|encoder = nvenc|' /home/${USER}/sunshine/sunshine.conf
# fi
# else
# # TODO: Enable the vaapi device if not using nvenc
# # vainfo --display drm --device /dev/dri/renderD128 2> /dev/null | grep -E "((VAProfileH264High|VAProfileHEVCMain|VAProfileHEVCMain10).*VAEntrypointEncSlice)"
# # Loop over any render devices
# echo
# fi
fi
# Reset the default username/password
@@ -38,7 +48,7 @@ fi
# Wait for the X server to start
wait_for_x
# Start the sunshine server
sunshine min_log_level=info /home/${USER}/sunshine/sunshine.conf &
sunshine /home/${USER}/sunshine/sunshine.conf &
sunshine_pid=$!