-
Notifications
You must be signed in to change notification settings - Fork 50
/
extract-files.sh
executable file
·44 lines (37 loc) · 1.12 KB
/
extract-files.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
#!/bin/bash
set -e
function extract() {
for FILE in `egrep -v '(^#|^$)' $1`; do
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"`
DEST=${PARSING_ARRAY[1]}
if [ -z $DEST ]; then
DEST=$FILE
fi
DIR=`dirname $FILE`
if [ ! -d $2/$DIR ]; then
mkdir -p $2/$DIR
fi
# Try CM target first
if [ "$SOURCEDIR" != "" ]; then
cp /$SOURCEDIR/$DEST $2/$DEST
else
adb pull /system/$DEST $2/$DEST
fi
# if file does not exist try OEM target
if [ "$?" != "0" ]; then
if [ "$SOURCEDIR" != "" ]; then
cp /$SOURCEDIR/$FILE $2/$DEST
else
adb pull /system/$FILE $2/$DEST
fi
fi
done
}
BASE=../../../vendor/$VENDOR/msm8960-common/proprietary
rm -rf $BASE/*
DEVBASE=../../../vendor/$VENDOR/$DEVICE/proprietary
rm -rf $DEVBASE/*
extract ../msm8960-common/proprietary-files.txt $BASE
extract ../$DEVICE/proprietary-files.txt $DEVBASE
./../msm8960-common/setup-makefiles.sh