-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathpush
executable file
·49 lines (41 loc) · 890 Bytes
/
push
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
#!/bin/bash
# author: tangliuxiang
PERMISSION=""
if [ "x$1" == "x-p" ]; then
PERMISSION=$2
shift
shift
fi
function usage()
{
echo "USAGE: push <local> <remote>"
echo " - copy file/dir to device"
echo "Just like the usage of adb push"
}
if [ "$#" -lt 2 ]; then
usage
exit 1
fi
progdir=`dirname $0`/su-tools
check-su 2>&1 > /dev/null
if [ $? == 0 ]; then
if [ "x$PERMISSION" != "x" ]; then
PERMISSION="-p $PERMISSION"
fi
su-push $PERMISSION $@ || exit $?
else
adb root
echo "wait for devices..."
adb wait-for-devices
adb remount
adb wait-for-devices
adb push $@ || exit $?
if [ "x$PERMISSION" != "x" ]; then
p_chmod="$progdir/phone-chmod"
phone_chmod=/data/local/tmp/phone-chmod
adb push $p_chmod $phone_chmod
adb shell chmod 777 $phone_chmod
adb shell $phone_chmod --after-push $1 $PERMISSION $2 || exit $?
fi
echo ">>> Success pushed $1 to $2"
fi