diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-03-02 13:44:06 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2021-08-14 11:59:31 +0200 |
commit | 4b769e3a6addf7e2dfaf0f2480a78ebec5746f26 (patch) | |
tree | a3a0d20969b114cf56fabaefb7f7f2420e376642 /.local/bin/firefox | |
parent | 7ccb879fb2f03be90b1e63f07e9d84a4daf8cb59 (diff) |
Try Firefox in a managed directory again
Diffstat (limited to '.local/bin/firefox')
-rwxr-xr-x | .local/bin/firefox | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/.local/bin/firefox b/.local/bin/firefox new file mode 100755 index 0000000..22d7a79 --- /dev/null +++ b/.local/bin/firefox @@ -0,0 +1,46 @@ +#!/bin/sh + +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU Affero General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. + +readonly BINS=" + /usr/bin/firefox + /usr/bin/firefox-bin +" + +main() +{ + require_exe "firejail" + + for bin in $BINS + do + [ -x "$bin" ] || continue + + exec firejail --profile="$HOME/.local/etc/firejail/firefox.profile" -- "$bin" "$@" + done + + printf "No underlying executable found for %s:\n" "${0##*/}" >&2 + + for bin in $BINS + do + printf "\t%s\n" "$bin" >&2 + done +} + +require_exe() +{ + if ! which "$1" 2>&1 > /dev/null + then + printf "Missing required executable %s\n" "$1" + exit 3 + fi +} + +main "$@" |