From fdad940b19b35572064e0f9925946bb4f9d0729a Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 13 Mar 2022 00:17:27 -0500 Subject: [iceweasel]: rename user profile dir this corresponds to (requires) the change in iceweasel-branding.git with commit message: 'rename user profile dir' --- libre/iceweasel/rename-profile.sh | 99 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 libre/iceweasel/rename-profile.sh (limited to 'libre/iceweasel/rename-profile.sh') 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 -- cgit v1.2.3