-
Notifications
You must be signed in to change notification settings - Fork 28
/
install-chromeandroid.sh
executable file
·51 lines (40 loc) · 1.76 KB
/
install-chromeandroid.sh
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
#! /bin/sh
set -u
LATEST=`curl -s http://commondatastorage.googleapis.com/chromium-browser-continuous/Android/LAST_CHANGE`
echo "Latest Chromium/Content Shell for Android is $LATEST\n"
TMP_DL=`mktemp -t chrome-android.XXXX` || { echo "FATAL: Could not create temp file"; exit 1; }
TMP_CHROME_APK=`mktemp -t chrome-android.XXXX` || { echo "FATAL: Could not create temp file"; exit 1; }
TMP_CONTENT_APK=`mktemp -t chrome-android.XXXX` || { echo "FATAL: Could not create temp file"; exit 1; }
REMOTE_APK=http://commondatastorage.googleapis.com/chromium-browser-continuous/Android/$LATEST/chrome-android.zip
echo "Downlaoding \n\t$REMOTE_APK \n\tto $TMP_DL\n"
curl $REMOTE_APK -o $TMP_DL || { echo "FATAL: downloading $TMP_APK failed"; exit 1; }
echo "Extracting ChromeShell.apk \n\t to $TMP_CHROME_APK...\n"
unzip -p $TMP_DL chrome-android/apks/ChromeShell.apk >> $TMP_CHROME_APK || { echo "FATAL: extracting $TMP_APK failed"; exit 1; }
echo "Extracting ChromiumTestShell.apk \n\t to $TMP_CONTENT_APK...\n"
unzip -p $TMP_DL chrome-android/apks/ContentShell.apk >> $TMP_CONTENT_APK || { echo "FATAL: extracting $TMP_APK failed"; exit 1; }
##
# Install flags
# '-l' means forward-lock the app
# '-r' means reinstall the app, keeping its data
# '-s' means install on SD card instead of internal storage
##
while getopts "rsl" opt; do
case $opt in
l)
echo "- with forward-lock" >&2
;;
r)
echo "- reinstalling, keeping data" >&2
;;
s)
echo "- on SD card \n" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
echo "Installing ContentShell..."
adb install $@ $TMP_CONTENT_APK || { echo "FATAL: adb install failed"; exit 1; }
echo "Installing ChromeShell..."
adb install $@ $TMP_CHROME_APK || { echo "FATAL: adb install failed"; exit 1; }