blob: 1438f155bbb7ebb3795fb59e77f0f9db694a141f (
plain)
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
47
48
49
50
51
52
53
54
55
56
|
# Copyright 2024 Ivan Boikov
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DESCRIPTION="Generating Firefox system-wide policies to handle addons and updates"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+noupdate +ublock redirect nocookiespopup"
RDEPEND="
ublock? ( www-plugins/ublock-origin-bin )
redirect? ( www-plugins/libredirect-bin )
nocookiespopup? ( www-plugins/istilldontcareaboutcookies-bin )
"
DEPEND="${RDEPEND}"
BDEPEND="app-misc/jq"
S="${WORKDIR}"
_add_addon_entry() {
echo "$1" | jq ".policies.ExtensionSettings +=
{ \"$2\" :
{
\"install_url\" : \"file:///usr/share/firefox-addons/$2.xpi\",
\"installation_mode\" : \"normal_installed\",
\"updates_disabled\" : true
}
}"
}
src_install() {
# firefox-bin installs policies to /opt/firefox/distribution/policies.json
# policy in /etc overrides it
dodir /etc/firefox/policies
policy=""
if use noupdate ; then
# browser updates
policy="$(jq -n '.policies += { "DisableAppUpdates" : true }')"
fi
if use ublock ; then
# uBlockOrigin
policy="$(_add_addon_entry "$policy" "uBlock0@raymondhill.net")"
fi
if use redirect ; then
# LibRedirect
policy="$(_add_addon_entry "$policy" "7esoorv3@alefvanoon.anonaddy.me")"
fi
if use nocookiespopup ; then
# I still don't care about cookies
policy="$(_add_addon_entry "$policy" "idcac-pub@guus.ninja")"
fi
echo "$policy" > "${D}/etc/firefox/policies/policies.json"
}
|