-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfirefox
More file actions
executable file
·46 lines (38 loc) · 1.5 KB
/
Copy pathfirefox
File metadata and controls
executable file
·46 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -eu
shopt -s nullglob
export FONTCONFIG_FILE=~/.config/fontconfig/browser.conf
export MOZ_USE_XINPUT2=1
[[ -x /usr/bin/firefox.real ]] && firefox_bin=/usr/bin/firefox.real || firefox_bin=/usr/bin/firefox
# Firefox disallows sideloading extensions from ~/.mozilla/extensions but
# there's an exception allowing sideloading them from system directories as
# these would normally be inaccessible to users. As a workaround, use bwrap to
# bind-mount the user-specific extensions into the system directory.
#
# Note that Debian patches the extensions.autoDisableScopes pref, other
# distributions of Firefox may disable the system dirs as well, but this is
# easily overridden in about:config.
function sideload-workaround {
local firefox_app_id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
local user_extension_dir=~/.mozilla/extensions/"$firefox_app_id"
local sys_extension_dir=/usr/share/mozilla/extensions/"$firefox_app_id"
local bwrap_extension_binds=()
local ext
for ext in "$user_extension_dir"/*; do
bwrap_extension_binds+=(--bind "$(readlink -f "$ext")" "$sys_extension_dir"/"${ext#"$user_extension_dir"/}")
done
for ext in "$sys_extension_dir"/*; do
bwrap_extension_binds+=(--bind "$(readlink -f "$ext")" "$ext")
done
local bwrap=(
bwrap
--bind /{,}
--dev-bind /dev{,}
--tmpfs "$sys_extension_dir"
"${bwrap_extension_binds[@]}"
--
${LD_LIBRARY_PATH+/usr/bin/env LD_LIBRARY_PATH="$LD_LIBRARY_PATH"}
)
exec "${bwrap[@]}" "$@"
}
sideload-workaround "$firefox_bin" "$@"