forked from yodaos-project/yoda.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime-op
executable file
·101 lines (90 loc) · 1.6 KB
/
runtime-op
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
#!/usr/bin/env bash
help="
Usage:
--lightd only apply to lightd service
--multimediad only apply to multimediad service
--vuid only apply to vuid service
--ttsd only apply to ttsd service
Options:
-s serial number.
By default operation is going to be applyed to all services.
Example:
$ ./tools/runtime-op --vuid restart
$ ./tools/runtime-op restart
"
lightd='NO'
multimediad='NO'
vuid='NO'
ttsd='NO'
only='NO'
sn=""
args=()
while [ $# -gt 0 ]; do
case "$1" in
-s)
sn="$2"
shift
;;
--lightd)
only='YES'
lightd='YES'
;;
--multimediad)
only='YES'
multimediad='YES'
;;
--vuid)
only='YES'
vuid='YES'
;;
--ttsd)
only='YES'
ttsd='YES'
;;
-h|--help)
printf "$help"
exit
;;
-*)
echo "Illegal option $1"
;;
*)
args=("${args[@]}" "$1")
;;
esac
shift $(( $# > 0 ? 1 : 0 ))
done
function shell() {
if test "$sn" != ""; then
adb -s "$sn" shell $1
else
adb shell $1
fi
}
function op {
echo "$2ing $1..."
if test "$sn" != ""; then
adb -s "$sn" shell "/etc/init.d/$1 $2"
else
adb shell "/etc/init.d/$1 $sn $2"
fi
}
shell "mount -o remount,rw /"
if test "$only" = 'NO'; then
lightd='YES'
multimediad='YES'
vuid='YES'
ttsd='YES'
fi
if test "$lightd" = 'YES'; then
op "lightd" "${args[0]}"
fi
if test "$multimediad" = 'YES'; then
op "multimediad" "${args[0]}"
fi
if test "$vuid" = 'YES'; then
op "vui-daemon" "${args[0]}"
fi
if test "$ttsd" = 'YES'; then
op "ttsd" "${args[0]}"
fi