This repository has been archived by the owner on May 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
extract-files.sh
executable file
·112 lines (105 loc) · 3.03 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
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
export COMMON_NAME="msm8610-common"
BASE=../../../vendor/$VENDOR/$VENDORDEVICEDIR/proprietary
rm -rf $BASE/*
for FILE in `egrep -v '(^#|^$)' ../$DEVICE/device-proprietary-files.txt`; do
echo "Extracting /system/$FILE ..."
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
FILE=${PARSING_ARRAY[0]}
DEST=${PARSING_ARRAY[1]}
if [ -z $DEST ]
then
DEST=$FILE
fi
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$COPY_FROM" = "" ]; then
adb pull /system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
adb pull /system/$DEST $BASE/$DEST
fi
else
cp $COPY_FROM/$FILE $BASE/$DEST
# if file does not exist try destination
if [ "$?" != "0" ]
then
cp $COPY_FROM/$DEST $BASE/$DEST
fi
fi
done
if [ -f ../$COMMON_NAME/proprietary-files.txt ]; then
for FILE in `egrep -v '(^#|^$)' ../$COMMON_NAME/proprietary-files.txt`; do
echo "Extracting /system/$FILE ..."
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
FILE=${PARSING_ARRAY[0]}
DEST=${PARSING_ARRAY[1]}
if [ -z $DEST ]
then
DEST=$FILE
fi
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$COPY_FROM" = "" ]; then
adb pull /system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
adb pull /system/$DEST $BASE/$DEST
fi
else
cp $COPY_FROM/$FILE $BASE/$DEST
# if file does not exist try destination
if [ "$?" != "0" ]
then
cp $COPY_FROM/$DEST $BASE/$DEST
fi
fi
done
fi
BASE=../../../vendor/$VENDOR/$COMMON_NAME/proprietary
rm -rf $BASE/*
for FILE in `egrep -v '(^#|^$)' ../$COMMON_NAME/common-proprietary-files.txt`; do
echo "Extracting /system/$FILE ..."
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
FILE=${PARSING_ARRAY[0]}
DEST=${PARSING_ARRAY[1]}
if [ -z $DEST ]
then
DEST=$FILE
fi
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$COPY_FROM" = "" ]; then
adb pull /system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
adb pull /system/$DEST $BASE/$DEST
fi
else
cp $COPY_FROM/$FILE $BASE/$DEST
# if file does not exist try destination
if [ "$?" != "0" ]
then
cp $COPY_FROM/$DEST $BASE/$DEST
fi
fi
done
echo "This is designed to extract files from an official cm-11.0 build"
../$COMMON_NAME/setup-makefiles.sh