dobu-run: Implement /dev/input access

This commit is contained in:
Peter Cai 2023-06-05 22:31:48 -04:00
parent 0ea062b5e4
commit 27eb066260
3 changed files with 19 additions and 1 deletions

View file

@ -3,3 +3,6 @@ HOMEDIR_STORAGE=$HOME/.local/share/dobu/homedir
# Whether btrfs subvolumes should be used for homes instead of
# normal subdirectories
HOMEDIR_IS_BTRFS=false
# Array of containers that are granted full /dev/input access
DEV_INPUT_ALLOWLIST=()

View file

@ -41,6 +41,14 @@ if [ ! -d "$home_path" ]; then
fi
fi
extra_args=""
# Check if we should allow /dev/input access
if is_in_array "$1" "${DEV_INPUT_ALLOWLIST[@]}"; then
log "Granting full /dev/input access"
extra_args="$extra_args -v /dev/input:/dev/input"
fi
# The fun part: start the container!
# Don't detach like we did with Sommelier, though
podman run --rm --userns=keep-id:uid=1100,gid=1100 \
@ -71,4 +79,4 @@ podman run --rm --userns=keep-id:uid=1100,gid=1100 \
-e QT_SCALE_FACTOR="$QT_SCALE_FACTOR" \
-e QT_SCREEN_SCALE_FACTORS="$QT_SCREEN_SCALE_FACTORS" \
-e QT_AUTO_SCREEN_SCALE_FACTOR="$QT_AUTO_SCREEN_SCALE_FACTOR" \
"$image_name"
$extra_args "$image_name"

View file

@ -23,6 +23,13 @@ log() {
echo "[$(date +%Y-%m-%dT%H:%M:%S)][dobu] $1"
}
is_in_array() {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
path_to_image_name() {
local context_path="$1"