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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/bin/bash
# rename existing 'firefox' user profile directory to 'iceweasel'
#
# NOTE: Prior to v99, if another Firefox is installed in addition to Iceweasel,
# both applications would share a profile, which is not very sane behavior.
# TODO: This source file could be deleted after a reasonable deprecation period.
#
# NOTE: The Iceweasel binary is inaccessible via the usual means
# (`iceweasel`, `/usr/bin/iceweasel`, or the iceweasel.desktop launcher).
# The binary has been renamed to ice-weasel, and replaced by this script.
# Therefore all usual means of launching, will go through this script.
Defer()
{
gxmessage -title "Parabola 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 "Parabola 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 another Firefox variant installed,
the other's 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 another Firefox variant installed,
it 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.
"
}
Launch() { /usr/lib/iceweasel/ice-weasel "$@" ; }
if [[ -d ~/.mozilla/firefox ]] && \
! [[ -e ~/.mozilla/iceweasel ]]
then # This is the expected 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
Launch "$@"
fi
else # This branch is executed in any of three cases:
# 1) The user has run Iceweasel or some other Firefox variant in the past,
# AND ~/.mozilla/iceweasel already exists for some reason.
# 2) The expected case, where the user has previously selected 'Copy'
# during a previous run of this script,
# perhaps from a previous Iceweasel release.
# 3) The remaining expected case, where the user has never run
# neither Iceweasel nor Firefox on this system.
# So, simply launch the binary.
# This is potentially problematic in the (unlikely) case #1;
# but is easily resolved manually: $ rm -rf ~/.mozilla/iceweasel
Launch "$@"
fi
|