forked from yodaos-project/yoda.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage-install
executable file
·127 lines (107 loc) · 2.31 KB
/
coverage-install
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
#!/usr/bin/env bash
set -e
help="
Usage:
-t Only includes tests.
-r Only includes resources.
-a Include tests and resources.
--no-app Exclude apps.
--no-os Exclude runtime and packages.
-s Select which device to be installed on if multiple devices presents.
Runtime installation by default, includes all packages, runtime, **no tests and resources**.
Example:
$ ./tools/coverage-install
$ ./tools/coverage-install -s 0502031835000257
"
os="YES"
test="NO"
resources="NO"
exclude_app='NO'
sn=""
while [ $# -gt 0 ]; do
case "$1" in
-t)
test="YES"
;;
--no-os)
os="NO"
;;
-r)
resources="YES"
os="NO"
;;
-a)
test="YES"
resources="YES"
;;
--no-app)
exclude_app="YES"
;;
-s)
sn="$2"
shift
;;
-h|--help)
printf "$help"
exit
;;
--*)
echo "Illegal option $1"
;;
esac
shift $(( $# > 0 ? 1 : 0 ))
done
function shell() {
if test "$sn" != ""; then
adb -s "$sn" shell $1
else
adb shell $1
fi
}
function push() {
echo "installing from $1 to $2"
if test "$sn" != ""; then
adb -s "$sn" push $1 $2 >/dev/null
else
adb push $1 $2 >/dev/null
fi
}
function install_os() {
# etc config
push "./etc/*" "/etc/yoda/"
# yoda runtime
push "./source-for-coverage/runtime/*" "/usr/yoda/"
# node_modules
shell "mkdir -p /usr/lib/node_modules/@yoda"
push "./source-for-coverage/packages/*" "/usr/lib/node_modules"
}
function install_test() {
shell "rm -rf /usr/lib/node_modules/tape"
shell "mkdir -p /usr/lib/node_modules/tape"
push "node_modules/tape/*" "/usr/lib/node_modules/tape"
push "node_modules/@yoda/*" "/usr/lib/node_modules/@yoda"
shell "rm -rf /data/workspace/test"
shell "mkdir -p /data/workspace/test"
push "test/*" "/data/workspace/test"
}
function install_resources() {
push "./source-for-coverage/res/light" "/opt/"
push "./source-for-coverage/res/media" "/opt/"
}
function install_apps {
# apps
push "./source-for-coverage/apps/*" "/opt/apps/"
}
shell "mount -o remount,rw /"
if test "$os" = "YES"; then
install_os
fi
if test "$resources" = "YES"; then
install_resources
fi
if test "$test" = 'YES'; then
install_test
fi
if test "$exclude_app" = 'NO'; then
install_apps
fi