forked from askeing/B2G-flash-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_channel.sh
executable file
·63 lines (54 loc) · 1.34 KB
/
change_channel.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
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#==========================================================================
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#==========================================================================
# setup a FxOS device for QA by forcing the 'nightly' update channel
set -e
while [ $# -gt 0 ]; do
case "$1" in
"-v")
VERSION="$2"
shift
;;
"-h")
echo "
Help:
-v <version> : version to update to (nightly, aurora, nightly-b2g32 for 2.0, nightly-b2g30 for 1.4)
-h : this help menu
"
;;
*)
;;
esac
shift
done
case "$VERSION" in
"nightly")
;;
"aurora")
;;
"nightly-b2g32")
;;
"nightly-b2g30")
;;
*)
echo "Please specify the version : -v (nightly, aurora, nightly-b2g32, nightly-b2g30)"
exit
;;
esac
UPDATE_CHANNEL=${UPDATE_CHANNEL:-$VERSION}
ADB=${ADB:-adb}
$ADB wait-for-device
B2G_PREF_DIR=/system/b2g/defaults/pref
TMP_DIR=/tmp/channel-prefs
rm -rf $TMP_DIR
mkdir $TMP_DIR
cat >$TMP_DIR/updates.js <<UPDATES
pref("app.update.channel", "$UPDATE_CHANNEL");
UPDATES
$ADB root
$ADB remount
$ADB push $TMP_DIR/updates.js $B2G_PREF_DIR/updates.js
$ADB shell "stop b2g; start b2g"