steam: add bwrap script to start steam
This commit is contained in:
parent
2ac3732781
commit
ae7d7a462a
|
@ -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 "$@"
|
Loading…
Reference in New Issue