forked from CyanogenMod/android_device_samsung_d2-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-files.sh
executable file
·116 lines (109 loc) · 2.64 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
113
114
115
116
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
SRC=adb
else
if [ $# -eq 1 ]; then
SRC=$1
else
echo "$0: bad number of arguments"
echo ""
echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
echo ""
echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
echo "the device using adb pull."
exit 1
fi
fi
BASE=../../../vendor/$VENDOR/$DEVICE/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 [ "$SRC" = "adb" ]; 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 $SRC/system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
cp $SRC/system/$DEST $BASE/$DEST
fi
fi
done
for FILE in `egrep -v '(^#|^$)' ../d2-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 [ "$SRC" = "adb" ]; 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 $SRC/system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
cp $SRC/system/$DEST $BASE/$DEST
fi
fi
done
BASE=../../../vendor/$VENDOR/d2-common/proprietary
rm -rf $BASE/*
for FILE in `egrep -v '(^#|^$)' ../d2-common/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 [ "$SRC" = "adb" ]; 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 $SRC/system/$FILE $BASE/$DEST
# if file dot not exist try destination
if [ "$?" != "0" ]
then
cp $SRC/system/$DEST $BASE/$DEST
fi
fi
done
./../d2-common/setup-makefiles.sh