-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathandroid.sh
More file actions
executable file
·67 lines (67 loc) · 1.6 KB
/
android.sh
File metadata and controls
executable file
·67 lines (67 loc) · 1.6 KB
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
#!/bin/sh
# build and package for android
set -ex
#[ -f configure ] ||
./autogen.sh
shopt -s nullglob
[ ! -f include/gettext.h ] || echo '#define gettext
#define bindtextdomain ' > include/gettext.h
: ${NDK:=~/bin/arm-linux-androideabi-9}
if [ -z "$JUDY_SRC" ]
then
for JUDY_SRC in ../judy*/src
do
:
done
fi
if [ -n "$JUDY_SRC" ]
then
JUDY_SRC="$(readlink -f "$JUDY_SRC")"
JUDY_INCLUDE="-I$JUDY_SRC"
JUDY_LIBS="-L$JUDY_SRC/obj/.libs"
fi
export PATH=$NDK/bin:"$PATH"
rm -rf build miredo.zip package
mkdir -p build
#[ -f Makefile ] ||
CFLAGS="-s \
-ffunction-sections -fdata-sections -Wl,--gc-sections \
-Wl,--wrap,pthread_create,--wrap,pthread_kill \
-O2 \
-DNDEBUG \
$JUDY_INCLUDE $JUDY_LIBS" \
ac_cv_file__proc_self_maps=true \
./configure \
--host=arm-linux-androideabi \
--prefix "$(readlink -f build)" \
--enable-android
make -j install
mkdir -p package/miredo
(
cd package
(
cd miredo
cp ../../build/{sbin/miredo,libexec/miredo/miredo-privproc,etc/miredo/client-hook} .
awk -v x="$(grep '^[^#]' ../../build/etc/miredo/miredo.conf | sed -e "s/'/'\\''/g" -e 's/^\(ServerAddress \).*/\1'\''"$relay\"'\''/')" '{gsub("=====CONFIG=====",x);print}' ../../android-mkshrc.sh > mkshrc
sed -e '1s:/s\?bin/:/system&:' \
-e 's:/sbin/ip:/system/bin/ip:g' \
-e '2,${/^#/d}' \
-e '/^$/d' \
-i client-hook
zip -r ../../miredo.zip * # exclude leading miredo/
)
)
exit
adb push miredo.zip /sdcard/miredo.zip
adb shell 'su -c '\''
set -x
killall miredo
killall -9 miredo miredo-privproc
cd /system || exit 1
rm -rf miredo
set -e
unzip -o /sdcard/miredo
cd miredo
chgrp 3003 miredo-privproc
./miredo
'\'''