Skip to content

Instantly share code, notes, and snippets.

@chr5tphr
Created March 1, 2019 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chr5tphr/d884963256de827c9c2e64802dac82eb to your computer and use it in GitHub Desktop.
Save chr5tphr/d884963256de827c9c2e64802dac82eb to your computer and use it in GitHub Desktop.
Bubblewrap semi isolation
#!/bin/sh
BWROOT="${BWROOT:-$PWD/base}"
env -i bwrap \
--bind "$BWROOT" / \
--unshare-user \
--unshare-cgroup \
--unshare-ipc \
--unshare-pid \
--unshare-uts \
--hostname isol \
--uid 1000 \
--gid 1000 \
--tmpfs /tmp \
--proc /proc \
--dev /dev \
--tmpfs /run \
--ro-bind /usr /usr \
--ro-bind /bin /bin \
--ro-bind /sbin /sbin \
--ro-bind /lib /lib \
--ro-bind /lib64 /lib64 \
--ro-bind /etc /etc \
--ro-bind /var /var \
--ro-bind /opt /opt \
--setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" \
--setenv TERM 'screen' \
--setenv COLORFGBG 'default;default' \
--setenv COLORTERM 'yes' \
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment