forked from SuperHanss/device_sony_yuga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract-files.sh
executable file
·70 lines (61 loc) · 1.53 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
#!/bin/bash
# Use tradition sort
export LC_ALL=C
FP=$(cd ${0%/*} && pwd -P)
export VENDOR=$(basename $(dirname $FP))
export DEVICE=$(basename $FP)
export BOARDCONFIGVENDOR=true
BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
while getopts ":nhsd:" options
do
case $options in
n ) NC=1 ;;
d ) LDIR=$OPTARG ;;
s ) SETUP=1 ;;
h ) echo "Usage: `basename $0` [OPTIONS] "
echo " -n No cleanup"
echo " -d Fetch blob from filesystem"
echo " -s Setup only, no extraction"
echo " -h Show this help"
exit ;;
* ) ;;
esac
done
if [ "x$NC" != "x1" ]; then
rm -rf $BASE/*
fi
for FILE in `grep -v ^# ../$DEVICE/proprietary-files.txt | grep -v ^$ | sort`
do
# Split the file from the destination (format is "file[:destination]")
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
FILE=${PARSING_ARRAY[0]}
DEST=${PARSING_ARRAY[1]}
if [[ "$FILE" =~ ^-.* ]]; then
FILE=`echo $FILE | sed s/^-//`
fi
if [ -z "$DEST" ]; then
DEST=$FILE
fi
DIR=`dirname $DEST`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "x$SETUP" != "x1" ]; then
if [ -z $LDIR ]; then
adb pull /system/$FILE $BASE/$DEST
else
cp $LDIR/system/$FILE $BASE/$DEST
fi
# if file dot not exist try destination
if [ "$?" != "0" ]; then
if [ -z $LDIR ]; then
adb pull /system/$DEST $BASE/$DEST
else
cp $LDIR/system/$DEST $BASE/$DEST
fi
fi
fi
done
../fusion3-common/setup-makefiles.sh
../fusion3-common/extract-files.sh
exit 0