forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrome-common
56 lines (49 loc) · 1.91 KB
/
chrome-common
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
#!/bin/sh -e
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This isn't a real target; it's the common commands for installing the various
# channels of the Google Chrome browser that the relevant targets source.
# This command expects CHANNEL to be set with the requested Google Chrome
# channel: stable, beta, or unstable.
if [ "${TARGETNOINSTALL:-c}" = 'c' -a "${ARCH#arm}" != "$ARCH" ]; then
echo 'Google Chrome does not yet have an ARM build. Installing Chromium instead.' 1>&2
TARGET=chromium
. "${TARGETSDIR:="$PWD"}/$TARGET"
fi
if [ "${TARGETNOINSTALL:-c}" = 'c' ] && release -lt saucy -lt jessie; then
echo "Google Chrome is not supported on $RELEASE anymore. Installing Chromium instead." 1>&2
TARGET=chromium
. "${TARGETSDIR:="$PWD"}/$TARGET"
fi
if [ "${TARGETNOINSTALL:-c}" = 'c' -a "$TARGET" != 'chrome' ]; then
# Avoid installing multiple chrome targets
if grep -q "^chrome\$" "${TARGETDEDUPFILE:-/dev/null}"; then
exit
else
echo "chrome" >> "${TARGETDEDUPFILE:-/dev/null}"
fi
fi
REQUIRES='x11'
. "${TARGETSDIR:="$PWD"}/common"
### Append to prepare.sh:
# Only download if it's not already installed, since it auto-updates
pkg="google-chrome-$CHANNEL"
if [ -n "`list_uninstalled '' "$pkg"`" ]; then
# Chrome needs hicolor-icon-theme to configure/install
install hicolor-icon-theme
url="https://dl.google.com/linux/direct/${pkg}_current_$ARCH.$PKGEXT"
tmp="`mktemp crouton.XXXXXX --tmpdir=/tmp`"
addtrap "rm -f '$tmp'"
wget "$url" -O "$tmp"
# Remove other providers of google-chrome, then install the package
for c in stable beta dev; do
c="google-chrome-$c"
if [ -z "`list_uninstalled '' "$c"`" ]; then
remove "$c"
fi
done
install_pkg "$tmp"
else
echo "$pkg is already installed."
fi