forked from alpartis/droid-VNC-server
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vnc-build.sh
executable file
·73 lines (56 loc) · 1.72 KB
/
vnc-build.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
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# $ vnc-build -a [18|19]
DAEMON_BUILD_PATH=libs/armeabi-v7a
LIB_BUILD_PATH=nativeMethods/libs/armeabi-v7a
PUSH_PATH=/sdcard/vnc/files
DEPLOY_PATH=/data/local/tmp
CWD=$(pwd)
android=19
usage="usage: $0 [-a N] -w -s"
clean() {
if [ -n "$do_build_wrapper" ]; then
rm ${LIB_BUILD_PATH}/libdvnc_flinger_sdk${android}.so
fi
rm ${DAEMON_BUILD_PATH}/*
}
build_wrapper() {
cd ../aosp
. build/envsetup.sh
cd external/nativeMethods
mm .
cd ${CWD}
}
deploy_vnc() {
SERIAL=$1
adb -s ${SERIAL} shell "su -c 'rm -d ${DEPLOY_PATH}/* 2>/dev/null'"
adb -s ${SERIAL} shell "su -c 'rm -d ${PUSH_PATH}/* 2>/dev/null'"
adb -s ${SERIAL} push ${LIB_BUILD_PATH}/libdvnc_flinger_sdk${android}.so ${PUSH_PATH}/libdvnc_flinger_sdk.so
adb -s ${SERIAL} push ${DAEMON_BUILD_PATH}/androidvncserver ${PUSH_PATH}/androidvncserver
if [ -e passwd ]; then
adb -s ${SERIAL} push passwd ${PUSH_PATH}/passwd
fi
adb -s ${SERIAL} shell "su -c 'cp ${PUSH_PATH}/* ${DEPLOY_PATH}/.'"
adb -s ${SERIAL} shell "su -c 'chmod 777 ${DEPLOY_PATH}/androidvncserver'"
adb -s ${SERIAL} shell "su -c 'chmod 644 ${DEPLOY_PATH}/libdvnc_flinger_sdk.so'"
adb -s ${SERIAL} shell "su -c 'chmod 644 ${DEPLOY_PATH}/passwd 2>/dev/null'"
}
while getopts ":a:ws" opt; do
case $opt in
a ) android=$OPTARG ;;
w ) do_build_wrapper='yep' ;;
s ) skip_deploy='yep' ;;
\? ) echo $usage
exit 1 ;;
esac
done
clean
ndk-build
if [ -n "$do_build_wrapper" ]; then
build_wrapper
fi
if [ -z "$skip_deploy" ]; then
serial_numbers=($(adb devices | awk '/device$/{print $1}'))
for i in "${serial_numbers[@]}"; do
deploy_vnc $i
done
fi