Skip to content

Instantly share code, notes, and snippets.

@Mufanc
Last active May 15, 2023 18:24
Show Gist options
  • Save Mufanc/a670fcfdf2714e0087093abdb0ef6315 to your computer and use it in GitHub Desktop.
Save Mufanc/a670fcfdf2714e0087093abdb0ef6315 to your computer and use it in GitHub Desktop.
TARGET="/usr/bin/typora"
if [ $(id -u) = 0 ]; then
rm /usr/bin/typora
cat <<-EOF > "$TARGET"
#!/usr/bin/sh
exec bwrap --unshare-all --share-net \
--ro-bind / / \
--dev-bind /dev /dev \
--tmpfs /tmp \
--tmpfs "$1" \
--bind "$1" "$1/Home" \
/usr/share/typora/Typora --no-sandbox
EOF
chmod +x "$TARGET"
else
sudo "$0" "$HOME"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment