summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2022-03-13 00:17:27 -0500
committerbill-auger <mr.j.spam.me@gmail.com>2022-03-26 05:57:45 -0400
commitfdad940b19b35572064e0f9925946bb4f9d0729a (patch)
tree5298977b05b8cf736eae2d6ee814e144d6f68b49
parent9d0cd632a5e27a5e04194ada36e2a2d458a702c8 (diff)
[iceweasel]: rename user profile dir
this corresponds to (requires) the change in iceweasel-branding.git with commit message: 'rename user profile dir'
-rw-r--r--libre/iceweasel/PKGBUILD18
-rwxr-xr-xlibre/iceweasel/rename-profile.sh99
2 files changed, 117 insertions, 0 deletions
diff --git a/libre/iceweasel/PKGBUILD b/libre/iceweasel/PKGBUILD
index e123f66a8..57a711174 100644
--- a/libre/iceweasel/PKGBUILD
+++ b/libre/iceweasel/PKGBUILD
@@ -37,6 +37,7 @@
# - allow skipping profiling build for x86_64 (_x86_64_skip_pgo)
# - prefer as many system libs as possible, over their vendored couterparts
# - Rebrand to Iceweasel, per the mozilla trademark policy, due to the FSDG changes
+# - set user profile directory to ~/.mozilla/iceweasel
#
# privacy:
# - Remove Google API keys and usage
@@ -596,4 +597,21 @@ END
if [[ -e $nssckbi ]]; then
ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
fi
+
+
+ # BEGIN RENAME_PROFILE
+ # replace binary with a temporary wrapper, to rename the user profile directory
+ # NOTE: prior to v98, if another 'firefox' is installed in addition to iceweasel,
+ # both applications would share a profile, which is not very sane behavior.
+ # TODO: this 'rename-profile' source file, and the following two LOC,
+ # could be removed after a reasonable deprecation period (eg: in 2023)
+ mv "${pkgdir}"/usr/lib/iceweasel/ice{,-}weasel
+ install -Dm755 ../rename-profile.sh "${pkgdir}"/usr/lib/iceweasel/iceweasel
+ # END RENAME_PROFILE
}
+
+
+# BEGIN RENAME_PROFILE - temporary - see note in package()
+depends+=(gxmessage) ; source+=(rename-profile.sh) ;
+sha256sums+=('e8f8a53ff340e36912c39247d40b6c2915bbbe437d2fc21b3e7cc09b1b534389')
+# END RENAME_PROFILE
diff --git a/libre/iceweasel/rename-profile.sh b/libre/iceweasel/rename-profile.sh
new file mode 100755
index 000000000..1ccdbdb7f
--- /dev/null
+++ b/libre/iceweasel/rename-profile.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+# NOTE: prior to v98, if another 'firefox' is installed in addition to iceweasel,
+# both applications would share a profile, which is not very sane behavior.
+# TODO: this file could be deleted after a reasonable deprecation period (eg: in 2023)
+
+
+Defer()
+{
+ gxmessage -title "Iceweasel Updater" \
+ -buttons "OK:0" \
+ -default "OK" \
+ -font "sans 16" \
+ -geometry 620x460 \
+ -center -wrap -ontop -sticky \
+"A new version of Iceweasel has been installed;
+but the upgrade can not continue just yet.
+
+A previous version of Iceweasel is already running.
+
+Please close all running Iceweasel windows,
+then start Iceweasel again.
+
+If this message persists, try restarting the computer."
+}
+
+Prompt()
+{
+ gxmessage -title "Iceweasel Updater" \
+ -buttons "Move:0,Copy:1" \
+ -default "Move" \
+ -font "monospace 12" \
+ -geometry 780x580 \
+ -center -wrap -ontop -sticky \
+"A new version of Iceweasel has been installed; but the upgrade can not continue just yet.
+
+This upgrade intends to move the storage location of the Iceweasel user profile, from ~/.mozilla/firefox to ~/.mozilla/iceweasel, in order to isolate it from other firefox variants.
+
+You have two options:
+
+ * 'Move': This is the recommended option,
+ if you do not have any other Firefox variants installed.
+ However, if you have other Firefox variants installed,
+ Otherwise, the others' preferences may be reset to defaults.
+ Parabola does not distribute any other Firefox variant,
+ which would be affected by this decision.
+ If all software on your computer came from the Parabola repos
+ (as recommended), then 'Move' is the best option.
+
+ * 'Copy': If you have other Firefox variants installed,
+ those will keep all user preferences as they are,
+ and Iceweasel will inherit the preferences.
+
+Note that neither option would affect Icecat, nor any other firefox variant
+which does not store user profiles under ~/.mozilla/firefox.
+"
+}
+
+
+# NOTE: the iceweasel binary is inaccessible via the normal means
+# (`iceweasel`, `/usr/bin/iceweasel`, or the iceweasel.desktop launcher).
+# the binary has been renamed to ice-weasel, and replaced by this script
+
+if [[ -d ~/.mozilla/firefox ]] && \
+ ! [[ -e ~/.mozilla/iceweasel ]]
+then # this is the most likely normal case, where the user has previously run
+ # either iceweasel or firefox on this system;
+ # and this is the first time that this script has run.
+ pids=( $(pgrep --euid ${EUID} firefox ) \
+ $(pgrep --euid ${EUID} iceweasel) )
+ if [[ -n "${pids[*]/$$/}" ]]
+ then # in this case, firefox or iceweasel is already running,
+ # so ask the user to terminate them
+ Defer
+ else # ready to move the profile directory.
+ # give the user the option to preserve the firefox profile,
+ # then launch the binary.
+ if Prompt
+ then mv ~/.mozilla/{firefox,iceweasel}
+ else cp -a ~/.mozilla/{firefox,iceweasel}
+ fi
+ /usr/lib/iceweasel/ice-weasel "$@"
+ fi
+else # this branch is executed in any of four cases:
+ # 1) the user has compiled a modified version of iceweasel,
+ # modified precisely to do what this script is attempting,
+ # AND has also run some other firefox variant in the past.
+ # 2) the user has run iceweasel or some other firefox variant in the past,
+ # AND ~/.mozilla/iceweasel exists accidentally.
+ # 3) the user has previously selected 'Copy' during a previous run of this script,
+ # installed with a previous 'iceweasel' release.
+ # 4) the remaining normal case, where the user has never run
+ # neither iceweasel nor firefox on this system.
+ # cases 1 and 2 could be distinguished; but both are very unlikely.
+ # so, simply launch the binary, and hope for the best.
+ # this is potentially problematic; but only in the (unlikely) case #2.
+ # case #2 is easily resolved manually: $ rm -rf ~/.mozilla/iceweasel
+ /usr/lib/iceweasel/ice-weasel "$@"
+fi