-
-
Save mricon/510d7a42a015d3b944e92e88de4adc9a to your computer and use it in GitHub Desktop.
Convenient wrapper for firejail and firefox
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 | |
# ff: convenient wrapper for firejail and firefox | |
# | |
# You can mix and match most keywords. Anything that's not a keyword | |
# will become the name of the private profile. | |
# | |
# Examples: | |
# ff | |
# - use basic defaults (no private directory, system resolver) | |
# ff 1dns personal | |
# - use a private directory in $HOME/firefox-profiles/personal | |
# - use the 1.1.1.1 server for domain resolution | |
# ff 8dns personal | |
# - use a private directory in $HOME/firefox-profiles/personal | |
# - use Google DNS servers for domain resolution | |
# ff 9dns junk | |
# - create a blank private profile and throw it away at the end of the | |
# session | |
# - use Quad DNS resolver | |
# ff work novirbr | |
# - use a private directory in $HOME/firefox-profiles/work | |
# - don't use a virtual bridge even if one is available | |
# ff nojail | |
# - just start firefox without firejail | |
# | |
if ip link show virbr0 2>/dev/null; then | |
net='--net=virbr0' | |
fi | |
while (( "$#" )); do | |
case "$1" in | |
nojail) | |
/usr/bin/firefox | |
exit 0 | |
;; | |
1dns) | |
dns='--dns=1.1.1.1' | |
;; | |
8dns) | |
dns='--dns=8.8.8.8 --dns=8.8.4.4' | |
;; | |
9dns) | |
dns='--dns=9.9.9.9' | |
;; | |
junk) | |
private="--private=$(mktemp -d)" | |
;; | |
novirbr) | |
net='' | |
;; | |
*) | |
private="--private=$HOME/firefox-profiles/$1" | |
mkdir -p $HOME/firefox-profiles/$1 | |
;; | |
esac | |
shift | |
done | |
firejail $dns $net $private firefox -no-remote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment