blob: f430a6f04982b7703eda3ecc9e758dabd47ebc21 (
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
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
102
103
104
105
106
107
108
109
110
|
# Directories
_user=det # User
_home=/home/$_user/ # $HOME
## Install for Mozilla Firefoxes
_firefox() {
echo -e "\nInstalling Mozilla Firefox leftovers..."
# Try to use existing profiles
IFS=$'\n' _ff_profiles=($(ls -d $_home/.mozilla/firefox/*.*/ 2>/dev/null))
if [[ $_ff_profiles ]]; then
for _ff_profile in ${_ff_profiles[@]}; do
# Install
install -d -o $_user $_ff_profile/extensions/support@lastpass.com/
bsdtar -xf /usr/share/lastpass/lp4_*.xpi -C $_ff_profile/extensions/support@lastpass.com/
# Enable auto-installation through 'extensions.autoDisableScopes'
echo 'user_pref("extensions.autoDisableScopes", 10);' >> $_ff_profile/prefs.js
echo 'user_pref("xpinstall.signatures.required", false);' >> $_ff_profile/prefs.js
# Set the correct ownerships
chown $_user $_ff_profile/extensions/
chown $_user -R $_ff_profile/extensions/support@lastpass.com/
done
else
# Create our own
install -d $_home/.mozilla/firefox/lastpass.default/extensions/support@lastpass.com/
bsdtar -xf /usr/share/lastpass/lp4_*.xpi -C \
$_home/.mozilla/firefox/lastpass.default/extensions/support@lastpass.com/
# Install 'profiles.ini'
install -m644 /usr/share/lastpass/profiles.ini $_home/.mozilla/firefox/
# Enable the auto-installation
echo "user_pref(\"extensions.autoDisableScopes\", 10);" >> \
$_home/.mozilla/firefox/lastpass.default/prefs.js
echo 'user_pref("xpinstall.signatures.required", false);' >> \
$_home/.mozilla/firefox/lastpass.default/prefs.js
# Set the correct ownerships
chown $_user -R $_home/.mozilla/
fi
}
post_install() {
_firefox
# Create the settings dir
install -d -o $_user $_home/.lastpass/
}
post_upgrade() {
post_install
}
post_remove() {
## Google Chromes/Chromiums
echo -e "\nRemoving from Google Chromes/Chromiums..."
for i in 'google-chrome' 'chromium' 'chromium-dev'; do
for j in 'hdokiejnpimakedhajhdlcegeplioahd' 'debgaelkhoipmbjnhpoblmbacnmmgbeg' \
'hnjalnkldgigidggphhmacmimbdlafdo' 'hgnkdfamjgnljokmokheijphenjjhkjc'; do
rm -rf $_home/.config/$i/Default/Extensions/$j/
done
done
## Mozilla Firefoxes
echo -e "\nRemoving from Mozilla Firefoxes..."
for i in $_home/.mozilla/firefox/*; do
rm -rf $i/extensions/support@lastpass.com/
done
# Get rid of anything we might have created
# 1) Omit our own stuff with bash's extglob ("!(argument1|argument2)") (turned on by default)
# 2) Use the $(wc -l)=2 to see, if extensions/ and prefs.js is all we have (our own stuff)
if [[ $(ls -d ~/.mozilla/firefox/lastpass/ 2>&- | wc -l) = 2 ]]; then
# Remove the profile folder
rm -r $_home/.mozilla/firefox/lastpass/
# If ~/.mozilla/firefox/ or the whole thing was created by us, get rid of them too
for j in firefox ""; do
if [[ ! $(ls -d $_home/.mozilla/$j/!(profiles.ini) 2>&-) ]]; then
rm -r $_home/.mozilla/$j/
fi
done
fi
## Operas
echo -e "\nRemoving from Operas...\n"
for i in .opera .opera-next; do
rm -rf $_home/$i/widgets/lastpass-*
# widgets.dat won't be cleaned automatically by Opera startup
if [[ $(grep "wuid-" $_home/$i/widgets/widgets.dat 2>&-) ]]; then
sed "/lastpass/,/section/d" \
-i $_home/$i/widgets/widgets.dat
else
rm $_home/$i/widgets/widgets.dat
fi
# If ~/.opera(-next)/widgets or the whole thing was created by us, get rid of them too
for j in widgets ""; do
if [[ ! $(ls $_home/$i/$j/ 2>&-) ]]; then
rm -r $_home/$i/$j/
fi
done
done
## Remove the settings dir
rm -rf $_home/.lastpass/
}
|