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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
|
post_install() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
#
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Add icons to the system icons
XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`"
if [ ! -x "$XDG_ICON_RESOURCE" ]; then
echo "Error: Could not find xdg-icon-resource" >&2
exit 1
fi
for icon in product_logo_24.png product_logo_256.png product_logo_48.png product_logo_64.png product_logo_16.png product_logo_32.png product_logo_128.png ; do
size="$(echo ${icon} | sed 's/[^0-9]//g')"
"$XDG_ICON_RESOURCE" install --size "${size}" "/opt/meetsidekick.com/sidekick/${icon}" \
"sidekick-browser"
done
UPDATE_MENUS="`which update-mime-database usr/share/mime &> /dev/null 2> /dev/null || true`"
if [ -x "$UPDATE_MENUS" ]; then
update-mime-database usr/share/mime &> /dev/null
fi
# Update cache of .desktop file MIME types. Non-fatal since it's just a cache.
update-desktop-database > /dev/null 2>&1 || true
# Updates defaults.list file if present.
update_defaults_list() {
# $1: name of the .desktop file
local DEFAULTS_FILE="/usr/share/applications/defaults.list"
if [ ! -f "${DEFAULTS_FILE}" ]; then
return
fi
# Split key-value pair out of MimeType= line from the .desktop file,
# then split semicolon-separated list of mime types (they should not contain
# spaces).
mime_types="$(grep MimeType= /usr/share/applications/${1} |
cut -d '=' -f 2- |
tr ';' ' ')"
for mime_type in ${mime_types}; do
if egrep -q "^${mime_type}=" "${DEFAULTS_FILE}"; then
if ! egrep -q "^${mime_type}=.*${1}" "${DEFAULTS_FILE}"; then
default_apps="$(grep ${mime_type}= "${DEFAULTS_FILE}" |
cut -d '=' -f 2-)"
egrep -v "^${mime_type}=" "${DEFAULTS_FILE}" > "${DEFAULTS_FILE}.new"
echo "${mime_type}=${default_apps};${1}" >> "${DEFAULTS_FILE}.new"
mv "${DEFAULTS_FILE}.new" "${DEFAULTS_FILE}"
fi
else
# If there's no mention of the mime type in the file, add it.
echo "${mime_type}=${1};" >> "${DEFAULTS_FILE}"
fi
done
}
update_defaults_list "sidekick-browser.desktop"
# This function uses sed to insert the contents of one file into another file,
# after the first line matching a given regular expression. If there is no
# matching line, then the file is unchanged.
insert_after_first_match() {
# $1: file to update
# $2: regular expression
# $3: file to insert
sed -i -e "1,/$2/ {
/$2/ r $3
}" "$1"
}
# If /usr/share/gnome-control-center/default-apps/gnome-default-applications.xml
# exists, it may need to be updated to add ourselves to the default applications
# list. If we find the file and it does not seem to contain our patch already
# (the patch is safe to leave even after uninstall), update it.
GNOME_DFL_APPS=/usr/share/gnome-control-center/default-apps/gnome-default-applications.xml
if [ -f "$GNOME_DFL_APPS" ]; then
# Conditionally insert the contents of the file "default-app-block" after the
# first "<web-browsers>" line we find in gnome-default-applications.xml
fgrep -q "Sidekick Web Browser" "$GNOME_DFL_APPS" || insert_after_first_match \
"$GNOME_DFL_APPS" \
"^[ ]*<web-browsers>[ ]*$" \
"/opt/meetsidekick.com/sidekick/default-app-block"
fi
# Add to the alternatives system
#
# On Ubuntu 12.04, we have the following priorities
# (which can be obtain be installing browsers and running
#
# /usr/bin/epiphany-browser 85
# /usr/bin/firefox 40
# /usr/bin/konqueror 30
#
# While we would expect these values to be keyed off the most popular
# browser (Firefox), in practice, we treat Epiphany as the lower bound,
# resulting in the following scheme:
CHANNEL=stable
case $CHANNEL in
stable )
# Good enough to be the default.
PRIORITY=200
;;
beta )
# Almost good enough to be the default. (Firefox stable should arguably be
# higher than this, but since that's below the "Epiphany threshold", we're
# not setting our priority below it. Anyone want to poke Firefox to raise
# their priority?)
PRIORITY=150
;;
unstable )
# Unstable, give it the "lowest" priority.
PRIORITY=120
;;
* )
PRIORITY=0
;;
esac
/usr/bin/sidekick-browser-stable $PRIORITY
/usr/bin/sidekick-browser-stable $PRIORITY
/usr/bin/sidekick-browser-stable $PRIORITY
# System-wide package configuration.
DEFAULTS_FILE="/etc/default/sidekick-browser"
# sources.list setting for sidekick-browser updates.
REPOCONFIG="deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
REPOCONFIGREGEX="deb (\[arch=[^]]*\bamd64\b[^]]*\][[:space:]]*) https?://dl.google.com/linux/chrome/deb/ stable main"
APT_CONFIG="`which apt-config 2> /dev/null`"
# You may comment out this entry, but any other modifications may be lost.\n"
# Install the repository/package signing keys, if they aren't already.
# (see also: https://www.google.com/linuxrepositories/)
# install_key() {
# APT_KEY="`which apt-key 2> /dev/null`"
# if [ ! -x "$APT_KEY" ]; then
# return
# fi
# NEED_KEYS=0
# # 2017 signing subkey
# "$APT_KEY" export 997C215E 2>&1 | \
# grep -q -- "-----BEGIN PGP PUBLIC KEY BLOCK-----"
# if [ $? -ne 0 ]; then
# NEED_KEYS=1
# fi
# # 2019 signing subkey
# "$APT_KEY" export 3CB3BD13 2>&1 | \
# grep -q -- "-----BEGIN PGP PUBLIC KEY BLOCK-----"
# if [ $? -ne 0 ]; then
# NEED_KEYS=1
# fi
# if [ $NEED_KEYS -eq 1 ]; then
# "$APT_KEY" add - >/dev/null 2>&1 <<KEYDATA
# -----BEGIN PGP PUBLIC KEY BLOCK-----
# mQINBFcMjNMBEAC6Wr5QuLIFgz1V1EFPlg8ty2TsjQEl4VWftUAqWlMevJFWvYEx
# BOsOZ6kNFfBfjAxgJNWTkxZrHzDl74R7KW/nUx6X57bpFjUyRaB8F3/NpWKSeIGS
# pJT+0m2SgUNhLAn1WY/iNJGNaMl7lgUnaP+/ZsSNT9hyTBiH3Ev5VvAtMGhVI/u8
# P0EtTjXp4o2U+VqFTBGmZ6PJVhCFjZUeRByloHw8dGOshfXKgriebpioHvU8iQ2U
# GV3WNIirB2Rq1wkKxXJ/9Iw+4l5m4GmXMs7n3XaYQoBj28H86YA1cYWSm5LR5iU2
# TneI1fJ3vwF2vpSXVBUUDk67PZhg6ZwGRT7GFWskC0z8PsW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nciY+kvSQ/boKjVHNGmf6+JBexd+HqPhkeextV6J
# cnmi47HDvIU/TSynhuqZeK/3SZAV7ESqQl42q7wm7Pqw0dkv4jjFCRxDA+Qq2aH6
# szJ7DZxTRWqfR3Zbe78NyFVXKxhFQO72zHzC3pFu/Ak59hmTU23yoXVo5t+5O+Q2
# 1kX2dbuLd6Px1bnT+EmyneoPP1Emea5jgsw2/ECqHnvNt6cbp+42XYldGh+PBHBm
# ucC3Mn7sALajHe5k2XkNlfbjSNlmutxQFH1qq9rh/JVyxJNHeGzV5G0timAwfdJF
# UzE1vNU5P0w4O8HrCsX5Ecfgcw2BQ9vPCE3OfG+11xp6oiNMRVsR5pTu7RiI1BQA
# yICWUW/wXuhhHkkwNTiwfciJfVA8ckOiRubik8geEH5boOxgeAaBu6yusQVHnRRy
# G4wjQ+qsWo+wDI9WMdtpNG1toJrSUL4OYa4oX3YogSv5hGrbYIaP4HwO6O2oTMnS
# 0lRIGJOqbEQcmKUa/nWT/3NipTnYzyMjMlEQe89YKjd+32tjMfOSdIOvwCGaTizd
# WnKPF77qB9D0v8C/7AdHmEFqf2ZX8vK31aaY+ZpPWG5IHlf6f/buIMBalJOxIBev
# eBqxcHwQ
# =4zaS
# -----END PGP PUBLIC KEY BLOCK-----
# KEYDATA
# fi
# }
find_apt_sources() {
eval $("$APT_CONFIG" shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
}
# Update the Google repository if it's not set correctly.
# Note: this doesn't necessarily enable the repository, it just makes sure the
# correct settings are available in the sources list.
# Returns:
# 0 - no update necessary
# 2 - error
update_bad_sources() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
find_apt_sources
SOURCELIST="$APT_SOURCESDIR/sidekick-browser.list"
# Don't do anything if the file isn't there, since that probably means the
# user disabled it.
if [ ! -r "$SOURCELIST" ]; then
return 0
fi
# Basic check for active configurations (non-blank, non-comment lines).
ACTIVECONFIGS=$(grep -v "^[[:space:]]*\(#.*\)\?$" "$SOURCELIST" 2>/dev/null)
# Check if the correct repository configuration is in there.
REPOMATCH=$(grep -E "^[[:space:]#]*\b$REPOCONFIGREGEX\b" "$SOURCELIST" \
2>/dev/null)
# Check if the correct repository is disabled.
MATCH_DISABLED=$(echo "$REPOMATCH" | grep "^[[:space:]]*#" 2>/dev/null)
# Now figure out if we need to fix things.
BADCONFIG=1
if [ "$REPOMATCH" ]; then
# If it's there and active, that's ideal, so nothing to do.
if [ ! "$MATCH_DISABLED" ]; then
BADCONFIG=0
else
# If it's not active, but neither is anything else, that's fine too.
if [ ! "$ACTIVECONFIGS" ]; then
BADCONFIG=0
fi
fi
fi
if [ $BADCONFIG -eq 0 ]; then
return 0
fi
# At this point, either the correct configuration is completely missing, or
# the wrong configuration is active. In that case, just abandon the mess and
# recreate the file with the correct configuration. If there were no active
# configurations before, create the new configuration disabled.
DISABLE=""
if [ ! "$ACTIVECONFIGS" ]; then
DISABLE="#"
fi
printf "$SOURCES_PREAMBLE" > "$SOURCELIST"
printf "$DISABLE$REPOCONFIG\n" >> "$SOURCELIST"
if [ $? -eq 0 ]; then
return 0
fi
return 2
}
# Returns:
# 0 - sources list was created
# 2 - error
create_sources_lists() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
find_apt_sources
SOURCELIST="$APT_SOURCESDIR/sidekick-browser.list"
if [ -d "$APT_SOURCESDIR" ]; then
printf "$SOURCES_PREAMBLE" > "$SOURCELIST"
printf "$REPOCONFIG\n" >> "$SOURCELIST"
if [ $? -eq 0 ]; then
return 0
fi
fi
return 2
}
# Remove our custom sources list file.
# Returns:
# 0 - successfully removed, or not configured
# !0 - failed to remove
clean_sources_lists() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
find_apt_sources
rm -f "$APT_SOURCESDIR/sidekick-browser.list" \
"$APT_SOURCESDIR/sidekick-browser-stable.list"
}
# Detect if the repo config was disabled by distro upgrade and enable if
# necessary.
handle_distro_upgrade() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
find_apt_sources
SOURCELIST="$APT_SOURCESDIR/sidekick-browser.list"
if [ -r "$SOURCELIST" ]; then
REPOLINE=$(grep -E "^[[:space:]]*#[[:space:]]*$REPOCONFIGREGEX[[:space:]]*# disabled on upgrade to .*" "$SOURCELIST")
if [ $? -eq 0 ]; then
sed -i -e "s,^[[:space:]]*#[[:space:]]*\(.*\)[[:space:]]*# disabled on upgrade to .*,\1," \
"$SOURCELIST"
LOGGER=$(which logger 2> /dev/null)
if [ "$LOGGER" ]; then
"$LOGGER" -t "$0" "Reverted repository modification: $REPOLINE."
fi
fi
fi
}
DEFAULT_ARCH="amd64"
get_lib_dir() {
if [ "$DEFAULT_ARCH" = "i386" ]; then
LIBDIR=lib/i386-linux-gnu
elif [ "$DEFAULT_ARCH" = "amd64" ]; then
LIBDIR=lib/x86_64-linux-gnu
elif [ "$DEFAULT_ARCH" = "armhf" ]; then
LIBDIR=lib/arm-linux-gnueabihf
elif [ "$DEFAULT_ARCH" = "arm64" ]; then
LIBDIR=lib/aarch64-linux-gnu
elif [ "$DEFAULT_ARCH" = "mipsel" ]; then
LIBDIR=lib/mipsel-linux-gnu
elif [ "$DEFAULT_ARCH" = "mips64el" ]; then
LIBDIR=lib/mips64el-linux-gnuabi64
else
echo Unknown CPU Architecture: "$DEFAULT_ARCH"
exit 1
fi
}
NSS_FILES="libnspr4.so.0d libplds4.so.0d libplc4.so.0d libssl3.so.1d \
libnss3.so.1d libsmime3.so.1d libnssutil3.so.1d"
add_nss_symlinks() {
get_lib_dir
for f in $NSS_FILES
do
target=$(echo $f | sed 's/\.[01]d$//')
if [ -f "/$LIBDIR/$target" ]; then
ln -snf "/$LIBDIR/$target" "/opt/meetsidekick.com/sidekick/$f"
elif [ -f "/usr/$LIBDIR/$target" ]; then
ln -snf "/usr/$LIBDIR/$target" "/opt/meetsidekick.com/sidekick/$f"
else
echo $f not found in "/$LIBDIR/$target" or "/usr/$LIBDIR/$target".
exit 1
fi
done
}
remove_nss_symlinks() {
for f in $NSS_FILES
do
rm -rf "/opt/meetsidekick.com/sidekick/$f"
done
}
remove_udev_symlinks() {
rm -rf "/opt/meetsidekick.com/sidekick/libudev.so.0"
}
remove_udev_symlinks
## MAIN ##
if [ ! -e "$DEFAULTS_FILE" ]; then
echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE"
fi
# Run the cron job immediately to perform repository configuration.
nohup sh /etc/cron.daily/sidekick-browser > /dev/null 2>&1 &
update-desktop-database -q
}
post_upgrade() {
post_install
}
pre_remove() {
#
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
action="$1"
if [ "$2" = "in-favour" ]; then
# Treat conflict remove as an upgrade.
action="upgrade"
fi
# Don't clean-up just for an upgrade.`
if [ "$action" = "upgrade" ] ; then
:
fi
# Remove icons from the system icons
XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`"
if [ ! -x "$XDG_ICON_RESOURCE" ]; then
echo "Error: Could not find xdg-icon-resource" >&2
exit 1
fi
for icon in product_logo_24.png product_logo_256.png product_logo_48.png product_logo_64.png product_logo_16.png product_logo_32.png product_logo_128.png ; do
size="$(echo ${icon} | sed 's/[^0-9]//g')"
"$XDG_ICON_RESOURCE" uninstall --size "${size}" "sidekick-browser"
done
UPDATE_MENUS="`which update-mime-database usr/share/mime &> /dev/null 2> /dev/null || true`"
if [ -x "$UPDATE_MENUS" ]; then
update-mime-database usr/share/mime &> /dev/null
fi
# Update cache of .desktop file MIME types. Non-fatal since it's just a cache.
update-desktop-database > /dev/null 2>&1 || true
# Remove from the alternatives system
}
post_remove() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
#
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
action="$1"
# Only do complete clean-up on purge.
if [ "$action" != "purge" ] ; then
:
fi
# System-wide package configuration.
DEFAULTS_FILE="/etc/default/sidekick-browser"
# sources.list setting for sidekick-browser updates.
REPOCONFIG="deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
update-desktop-database -q
}
|