x11-pulse-nvidia/bin/run.sh
2025-04-21 13:42:58 +02:00

60 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -o errexit
APPL_HOME_DIR="$(dirname "$(dirname "$0")")"
#-------------------------------------------------------------------------------
export APPL_NETWORK="no-internet"
export PULSE_DISABLE_FLAG=""
while [[ "$1" == "-h" || "$1" == "-d" || "$1" == "-i" ]]
do
if [[ "$1" == "-h" ]]
then
echo "usage: run.sh [-h] [-d] [-i] <Application_Dir> <Application_Exec> [Args...]"
echo "with -d disabling sound,"
echo "with -i enabling internet access."
exit 0
fi
if [[ "$1" == "-d" ]]
then
shift;
export PULSE_DISABLE_FLAG="-disabled"
fi
if [[ "$1" == "-i" ]]
then
shift;
export APPL_NETWORK="internet"
fi
done
export APPL_DIR="$1"
shift
export APPL_NAME="$1"
shift
APPL_DIR=$(realpath "${APPL_DIR}")
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
export GROUP_NAME=$(id -gn)
cd "${APPL_HOME_DIR}"
sbin/docker_mk_env
docker compose run --rm x11-pulse-nvidia /usr/local/sbin/user_add_exec ${USER_ID} ${USER} ${HOME} ${GROUP_ID} ${GROUP_NAME} "${APPL_DIR}" "${APPL_NAME}" "$@"
docker compose down