summaryrefslogtreecommitdiff
path: root/www-misc/arkenfox/arkenfox-135.0-r1.ebuild
diff options
context:
space:
mode:
authorIvan K. Boikov <mail@ikboikov.net>2025-07-04 19:58:09 +0000
committerroot <root@laptop.lan>2025-07-04 20:51:11 +0000
commit1424eac77c8f01b35fa87fd56410a71971fb49a4 (patch)
treedf2901c23fd5c09cf7e351849c9ce77e80d045b7 /www-misc/arkenfox/arkenfox-135.0-r1.ebuild
parentf31619024a0b70de6c21eaceb51d0748b5255210 (diff)
arkenfox: 135.0 -> 135.0-r1
Diffstat (limited to 'www-misc/arkenfox/arkenfox-135.0-r1.ebuild')
-rw-r--r--www-misc/arkenfox/arkenfox-135.0-r1.ebuild71
1 files changed, 71 insertions, 0 deletions
diff --git a/www-misc/arkenfox/arkenfox-135.0-r1.ebuild b/www-misc/arkenfox/arkenfox-135.0-r1.ebuild
new file mode 100644
index 0000000..719e81a
--- /dev/null
+++ b/www-misc/arkenfox/arkenfox-135.0-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 2024 Ivan Boikov
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit savedconfig
+
+DESCRIPTION="Firefox privacy, security and anti-tracking: a comprehensive user.js template for configuration and hardening"
+HOMEPAGE="https://github.com/arkenfox/user.js"
+VER="135.0"
+SRC_URI="https://github.com/arkenfox/user.js/archive/refs/tags/${VER}.tar.gz -> arkenfox-${VER}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="+savedconfig"
+
+RDEPEND="
+"
+DEPEND="${RDEPEND}"
+BDEPEND=""
+
+S="${WORKDIR}"
+
+sanitize() {
+ # firefox is restrictive about the config content, so only leave the bare minimum
+ # arkenfox's updating script does a similar thing
+ cat "$1" | grep "user_pref" | grep -v "// user_pref" | sed "s/^user_pref/pref/g"
+}
+
+src_prepare() {
+ default
+
+ tar -xf "${DISTDIR}/arkenfox-${VER}.tar.gz"
+
+ restore_config 'user-overrides.js'
+ if [ ! -f "user-overrides.js" ]; then
+ echo '// user_pref("parameter", "value")' > "user-overrides.js"
+ fi
+}
+
+src_compile() {
+ echo "// IMPORTANT: Start your code on the 2nd line" > "user.js-${VER}/arkenfox.cfg"
+ sanitize "user.js-${VER}/user.js" >> "user.js-${VER}/arkenfox.cfg"
+ sanitize "user-overrides.js" >> "user.js-${VER}/arkenfox.cfg"
+}
+
+src_install() {
+ # https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
+ dodir "/etc/firefox/defaults/pref"
+ cat >> "${D}/etc/firefox/defaults/pref/autoconfig.js" << EOF
+pref("general.config.filename", "arkenfox.cfg");
+pref("general.config.obscure_value", 0);
+EOF
+
+ # it appears we can only install configs inside the install directory
+ if [ -d "/opt/firefox" ]; then # "firefox-bin" in installed
+ dodir "/opt/firefox"
+ cp "user.js-${VER}/arkenfox.cfg" "${D}/opt/firefox/"
+ fi
+ if [ -d "/usr/lib64/firefox" ]; then # "firefox" in installed
+ dodir "/usr/lib64/firefox"
+ cp "user.js-${VER}/arkenfox.cfg" "${D}/usr/lib64/firefox/"
+ fi
+ if [ -d "/usr/lib/firefox" ]; then # "firefox" in installed but somehow not in lib64
+ dodir "/usr/lib/firefox"
+ cp "user.js-${VER}/arkenfox.cfg" "${D}/usr/lib/firefox/"
+ fi
+
+ save_config 'user-overrides.js'
+}