-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patha-push-installed
executable file
·80 lines (75 loc) · 2.13 KB
/
a-push-installed
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
74
75
76
77
78
79
80
#!/bin/bash
# Copyright (C) 2012 Texas Instruments
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Gabriel M. Beddingfield <[email protected]>
#
# DESCRIPTION OF a-push-installed
# -------------------------------
#
# After rebuilding something marginally for android
# (e.g. libtinyalsa.so), if you capture the output of 'make' then you
# can use this script to push to the device /only/ the new files.
#
# Before executing this command, you /must/ be root on the device and
# have /system remounted read/write:
#
# $ adb root
# $ adb remount
#
# Typical usage (from inside your 'mydroid' folder):
#
# $ m libfoo 2>&1 | tee log.txt
# $ a-push-installed log.txt .
#
# This is especially helpful when you're inside a module:
#
# $ cd external/foo
# $ mm 2>&1 | tee log.txt
# $ a-push-installed log.txt ../..
#
# The program depends on 'adb' being in the current path.
#
if [ $# -lt 2 ] ; then
echo "Usage: a-push-installed <logfile> <path/to/mydroid>"
echo "Example: a-push-installed log.txt ."
exit
fi
if [ -z "$1" ] ; then
echo "Must provide log file name"
exit 1
fi
LOGFILE="$1"
if [ -z "$2" ] ; then
PROOT="."
else
PROOT="$2"
fi
if [ "$LOGFILE" == "last" ] ; then
LOGFILE=$(ls log-* | sort -r | head -1)
if [ -z "$LOGFILE" ] ; then
echo "Error: Could not discern what the last logfile was. (expected log-*)"
exit 1
fi
echo "Using log file $LOGFILE"
fi
for N in $(grep "^Install: " "$LOGFILE" | sed 's/^Install: //') ; do
N="$PROOT/$N"
M=$(echo $N | sed 's/.*\/system\//\/system\//')
if [ "$N" == "$M" ] ; then
continue
fi
echo "$N ==> $M"
adb push "$N" "$M"
done