forked from Spirtix/android_device_huawei_HWPLK
-
Notifications
You must be signed in to change notification settings - Fork 5
/
extract-files.sh
69 lines (60 loc) · 1.71 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
#!/bin/bash
#by Nexolight
VENDORNAME="huawei"
CODENAME="hwgra"
PFILES="device/$VENDORNAME/$CODENAME/proprietary-files6.0.txt"
USEADB=false
echo "###############################################"
echo "# Placing vendor blobs"
echo "# for $VENDORNAME $CODENAME"
echo "###############################################"
echo $PWD
VDIR="vendor/$VENDORNAME/$CODENAME"
DST="$VDIR/proprietary"
if [ -d $DST ];then
echo "Cleaning up..."
rm -rf $DST
fi
echo "Create output dir..."
mkdir -p $DST
if [ $USEADB = false ];then
SOURCE="device/$VENDORNAME/$CODENAME/vendor/system"
echo "Source is $SOURCE"
# echo "assuming that it just contains the listed files!"
# echo "cp -r $SOURCE $DST"
# cp -r $SOURCE/* $DST
echo "Using: $PFILES"
COUNT=0
for VBLOB in $(grep -v -E "(^\s*?#.*$)|(^\s*$)" $PFILES);do
if [ -d $VBLOB ];then
VBLOB="$VBLOB/."
fi
echo "copying $SOURCE/$VBLOB to $DST/$VBLOB"
if $(mkdir -p $DST/`dirname $VBLOB` && cp $SOURCE/$VBLOB $DST/$VBLOB);then
COUNT=$(($COUNT+1))
fi
done
echo "###############################################"
echo "# Copied $COUNT blobs"
echo "###############################################"
echo "done"
else
echo "Source is adb"
echo "Using: $PFILES"
COUNT=0
SOURCE="system"
for VBLOB in $(grep -v -E "(^\s*?#.*$)|(^\s*$)" $PFILES);do
if [ -d $VBLOB ];then
VBLOB="$VBLOB/."
fi
echo "adb pull $SOURCE/$VBLOB $DST/$VBLOB"
if $(adb pull $SOURCE/$VBLOB $DST/$VBLOB);then
COUNT=$(($COUNT+1))
fi
done
echo "###############################################"
echo "# Copied $COUNT blobs"
echo "###############################################"
fi
echo "calling setup-makefiles.sh now"
device/$VENDORNAME/$CODENAME/setup-makefiles.sh $VENDORNAME $CODENAME $VDIR $PFILES