-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-files.sh
executable file
·49 lines (44 loc) · 1.38 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
45
46
47
48
49
#!/bin/sh
if [ $# -eq 1 ]; then
COPY_FROM=$1
test ! -d "$COPY_FROM" && echo error reading dir "$COPY_FROM" && exit 1
fi
test -z "$DEVICE" && echo device not set && exit 2
test -z "$VENDOR" && echo vendor not set && exit 2
test -z "$VENDORDEVICEDIR" && VENDORDEVICEDIR=$DEVICE
export VENDORDEVICEDIR
BASE=../../../vendor/$VENDOR/$VENDORDEVICEDIR/proprietary
rm -rf $BASE/*
rm -rf $BASE/../packages 2> /dev/null
for FILE in `cat ../vanquish-common/proprietary-files.txt | grep -v ^# | cut -f1 -d '#' | grep -v ^$`; do
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$COPY_FROM" = "" ]; then
adb pull /system/$FILE $BASE/$FILE
else
cp -p "$COPY_FROM/$FILE" $BASE/$FILE
fi
if [ "X$DIR" == "Xapp" ]; then
mkdir -p ${BASE}/../packages
mv $BASE/$FILE ${BASE}/../packages/
fi
done
for FILE in `cat ../${DEVICE}/proprietary-files.txt | grep -v ^# | cut -f1 -d '#' | grep -v ^$`; do
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$COPY_FROM" = "" ]; then
adb pull /system/$FILE $BASE/$FILE
else
cp -p "$COPY_FROM/$FILE" $BASE/$FILE
fi
if [ "X$DIR" == "Xapp" ]; then
mkdir -p ${BASE}/../packages
mv $BASE/$FILE ${BASE}/../packages/
fi
done
rmdir ${BASE}/app 2> /dev/null
../vanquish-common/setup-makefiles.sh