forked from kosborn/p2p-adb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testDynLoad.sh
executable file
·72 lines (51 loc) · 1.45 KB
/
testDynLoad.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
# p2p-adb
# https://github.com/kosborn/p2p-adb/
# @theKos
# THIS IS JUST A TEST SCRIPT TO MAKE SURE DYNAMIC MODULE LOAD IS OKAY.
# If adb is not in your $PATH, configure it with the line below
#alias adb=/home/usr/bin/adb
if [ $tryStaticADB -eq 0 ]; then
# assume it's in $PATH...
adb=$(which adb)
else
adbTMP=$PWD/includes/adb-arm-static
su -c "cp ${adbTMP} /data/local/tmp/adb-arm-static"
adb=/data/local/tmp/adb-arm-static
su -c "chmod 777 ${adb}"
fi
# If you don't need busybox (i.e. laptop), set this to 1
IGNOREBUSYBOX=0
commandList=""
. ./functions.sh
for modules in ./modules/*.sh; do
. $modules
done
generateCommands
echo "Here is a list of commands: "
for i in $(echo $commandList|tr "@" "\n"|sort -n ); do
echo $i|awk -F: {'print $1") "$3'}|tr "_" " "
done
echo "Select a command:"
read userCommand
deviceConnected=isConnected
if [ "$(isConnected)" = 'NO' ]; then eval $(echo '$COMMAND'$userCommand)
echo "Waiting for phone to connect..."
# probably a better way to do this... but I don't care!!
#while [ "$(isConnected)" = 'NO' ]; do
# sleep .1
#done
# Found it! Hopefully this won't cause issues
adb wait-for-device
fi
# check if we're root!
# Note: This is here because sh's variable scopig doesn't go UP apparently...
if [ $RUNONCE = 0 ]
then
ISROOT=$(isRoot noinfo)
if [ "$ISROOT" = "1" ]
then
echo 'WE ARE THE ROOT!'
RUNONCE=1
fi
fi