Created
December 23, 2022 13:13
-
-
Save sulincix/d040df5fc6e48ad1fdf18cc4e1c8bda6 to your computer and use it in GitHub Desktop.
Sandbox with bubblewrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ! which "$1" &> /dev/null ; then | |
exit 127 | |
fi | |
xhost +local: | |
mkdir -p "$HOME/.sandbox/home/$1" | |
exec env -i DISPLAY=$DISPLAY PULSE_SERVER=127.0.0.1 bwrap --bind / / \ | |
--dev /dev \ | |
--tmpfs /tmp --tmpfs /dev/shm \ | |
--bind /dev/dri /dev/dri \ | |
--bind /tmp/.X11-unix /tmp/.X11-unix \ | |
--bind /dev/kvm /dev/kvm \ | |
--bind "$HOME/.sandbox/home/$1" $HOME \ | |
--bind /dev/snd /dev/snd \ | |
--tmpfs /run/user/`id -u` \ | |
--hostname sandbox-$$ --unshare-uts \ | |
dbus-run-session sh -c "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment