summaryrefslogtreecommitdiffstats
path: root/extract-files.sh
diff options
context:
space:
mode:
authordhacker29 <davidhackerdvm@gmail.com>2013-12-13 23:21:58 -0600
committerZiyann <jaraidaniel@gmail.com>2014-11-14 09:15:09 +0100
commitc4e667073ce113e621ae440ae6af62bbe0a8dc64 (patch)
tree19adac427acae4aaf0a7266749c9cdfdc53b099d /extract-files.sh
parent476f0a160ef9e49a2b8daeda9aa0532ff66989a3 (diff)
downloaddevice_samsung_tuna-c4e667073ce113e621ae440ae6af62bbe0a8dc64.zip
device_samsung_tuna-c4e667073ce113e621ae440ae6af62bbe0a8dc64.tar.gz
device_samsung_tuna-c4e667073ce113e621ae440ae6af62bbe0a8dc64.tar.bz2
Setup common tuna extract-files/remove Google self-extractors
Since tuna devices are no longer maintained by AOSP there is no need to have multiple locations and duplicate files. This Will put all common files in vendor/samsung/tuna and device specific ones in vendor/samsung/$(DEVICE). Change-Id: I51bba2e62a1b511958856863f0a0fceac957704e
Diffstat (limited to 'extract-files.sh')
-rwxr-xr-xextract-files.sh109
1 files changed, 109 insertions, 0 deletions
diff --git a/extract-files.sh b/extract-files.sh
new file mode 100755
index 0000000..e80ec47
--- /dev/null
+++ b/extract-files.sh
@@ -0,0 +1,109 @@
+#!/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
+
+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
+
+for FILE in `egrep -v '(^#|^$)' ../tuna/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
+
+BASE=../../../vendor/$VENDOR/tuna/proprietary
+rm -rf $BASE/*
+for FILE in `egrep -v '(^#|^$)' ../tuna/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 build"
+../tuna/setup-makefiles.sh