-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit
executable file
·78 lines (64 loc) · 1.74 KB
/
init
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
#!/bin/sh
CURWDIR="$(cd $(dirname $0) && pwd)"
TITLE="WPS"
PROGRAM_NAME="app-wps"
CUSTOM_BIN="/system/apps/tp/bin/custom"
CUSTOM_CONFIG_FILE="$CURWDIR/custom.conf"
APPS_CONFIG_DIR="/data/conf"
LAUNCHER_CONFIG_DIR="$APPS_CONFIG_DIR/launcher/conf.d"
LAUNCHER_CONFIG_FILE="$LAUNCHER_CONFIG_DIR/$PROGRAM_NAME.conf"
ICON="./res/wps_normal.png"
PRESSED_ICON="./res/wps_pressed.png"
PID_FILE="$CURWDIR/$PROGRAM_NAME.pid"
PKILL_BIN="/usr/bin/pkill"
INSTALL_BIN="/usr/bin/install"
REMOVE="/bin/rm -f"
usage() {
echo "ERROR: action missing"
echo "syntax: $0 <start|stop|restart|status|config|install|uninstall>"
echo "example: $0 start"
}
start() {
rm /tmp/wps-count
/system/sbin/wps.sh
$CURWDIR/progress -t WPS一键连 -m 请在30秒内按下设备上的wps按键,连接成功后可选择退出。 -j $CURWDIR/calc-progress.sh -p /tmp/wps-percent &
}
stop() {
echo "not implemented"
}
config() {
echo "{" > "$PROGRAM_NAME.conf"
echo "\"name\" : \"$TITLE\"," >> "$PROGRAM_NAME.conf"
echo "\"icon\" : \"$CURWDIR/$ICON\"," >> "$PROGRAM_NAME.conf"
echo "\"iconPressed\" : \"$CURWDIR/$PRESSED_ICON\"," >> "$PROGRAM_NAME.conf"
echo "\"exec\" : \"$CURWDIR/init start\"," >> "$PROGRAM_NAME.conf"
echo "\"msgNum\" : 4" >> "$PROGRAM_NAME.conf"
echo "}" >> "$PROGRAM_NAME.conf"
$INSTALL_BIN -d $LAUNCHER_CONFIG_DIR
$INSTALL_BIN "$PROGRAM_NAME.conf" "$LAUNCHER_CONFIG_FILE"
}
uninstall() {
$REMOVE "$LAUNCHER_CONFIG_FILE"
}
# main
if [ $# -lt 1 ]; then
usage
exit 255
fi
case "$1" in
"start" )
start;;
"stop" )
stop;;
"run" )
run;;
"restart" )
start
stop;;
"install" )
config;;
"uninstall" )
uninstall;;
* )
usage ;;
esac