-
Notifications
You must be signed in to change notification settings - Fork 0
/
adb_push.sh
executable file
·54 lines (47 loc) · 1.01 KB
/
adb_push.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
#!/bin/bash
echo -ne "\033]0;ADB Push\007"
export PATH=${PATH}:/home/tristan202/android-sdk/platform-tools/
Output() {
echo "$(date -d "1970-01-01 UTC $2 seconds") - $1"
}
Duration() {
local S=$(echo $FINISH_TIME $BEGIN_TIME | awk '{print$1-$2}')
((h=S/3600))
((m=S%3600/60))
((s=S%60))
printf "Pushing took: %dh:%dm:%ds\n" $h $m $s
}
Begin() {
BEGIN_TIME=$(date +%s)
Output Begin $BEGIN_TIME "$1"
}
Finish() {
FINISH_TIME=$(date +%s)
Output Finished $FINISH_TIME "$1"
Duration
}
fbname=`basename "$2"`
Begin
if pidof -x adb > /dev/null
then
echo ""
echo "ADB server already running, proceeding."
echo ""
else
adb start-server
fi
if [ "$1"="int" -a "$1" != "ext" ]; then
echo "Pushing $fbname to /sdcard/$fbname"
adb push "$2" /sdcard/
echo "Done!"
Finish
read -p "Press [Enter] to continue."
exit 0
elif [ "$1"="ext" -a "$1" != "int" ]; then
echo "Pushing $fbname to /ext_card/$fbname"
adb push "$2" /ext_card/
echo "Done!"
Finish
read -p "Press [Enter] to continue."
exit 0
fi