1
0
Fork 0

steam: add bwrap script to start steam

This commit is contained in:
Luca Bilke 2024-10-30 16:02:52 +01:00
parent 2ac3732781
commit ae7d7a462a
Signed by: luca
GPG Key ID: F6E11C9BAA7C82F5
1 changed files with 49 additions and 0 deletions

49
common/.local/bin/steam Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
set -euo pipefail
STEAM_ROOT="${XDG_DATA_HOME}/steamroot"
mkdir -p "$STEAM_ROOT"
args=(
--die-with-parent
--dev-bind /dev /dev
--proc /proc
--bind /run /run
--bind /sys /sys
--bind /tmp /tmp
--ro-bind /lib /lib
--ro-bind /lib32 /lib32
--ro-bind /lib64 /lib64
--bind "$STEAM_ROOT" "$HOME"
--chdir "$HOME"
--unsetenv XDG_CACHE_HOME
--unsetenv XDG_CONFIG_HOME
--unsetenv XDG_DATA_HOME
--unsetenv XDG_STATE_HOME
--tmpfs /tmp/.X11-unix
)
install -m 1777 -d /tmp/dumps
args+=(--bind-try /tmp/dumps /tmp/dumps)
for dir in /bin /etc /lib /lib64 /sbin /usr /var; do
args+=(--ro-bind "$dir" "$dir")
done
if [[ "${DISPLAY}" == *:* ]]; then
display_nr=$(echo "$DISPLAY" | cut -d':' -f2 | cut -d'.' -f1)
local_socket="/tmp/.X11-unix/X${display_nr}"
args+=(--ro-bind-try "$local_socket" "$local_socket")
fi
if [[ "${XAUTHORITY:-}" == /tmp/* ]]; then
args+=(--ro-bind-try "$XAUTHORITY" "$XAUTHORITY")
fi
exec bwrap "${args[@]}" -- /usr/bin/steam -disable-cef-sandbox "$@"