summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Hagendorn <git@finnq.de>2017-01-06 23:54:15 +0100
committer5x <droidfivex@gmail.com>2017-02-07 10:17:10 +0900
commitd2e456714bfb895824bb591148a3afa8ffc25873 (patch)
treeae0574305d0efea7a1335051fb579ef7c88b6915
parente9974945ba0b1a5c0757d5edaa169a69ade3a3d9 (diff)
mako: Use the generic extractor
Change-Id: Iccb37d62421913651bc359c8194bb0fd5039cca3
-rwxr-xr-xextract-files.sh73
-rwxr-xr-xsetup-makefiles.sh74
2 files changed, 74 insertions, 73 deletions
diff --git a/extract-files.sh b/extract-files.sh
index 4718457..fb9a3f8 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -1,40 +1,57 @@
-#!/bin/sh
+#!/bin/bash
+#
+# Copyright (C) 2017 The LineageOS Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
set -e
-VENDOR=lge
DEVICE=mako
+VENDOR=lge
-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."
+# Load extractutils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
+
+CM_ROOT="$MY_DIR"/../../..
+
+HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
exit 1
- fi
fi
+. "$HELPER"
-BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
-rm -rf $BASE/*
-
-for FILE in `cat proprietary-blobs.txt | grep -v ^# | grep -v ^$ | grep -v ^-`; do
- DIR=`dirname $FILE`
- if [ ! -d $BASE/$DIR ]; then
- mkdir -p $BASE/$DIR
- fi
- if [ "$SRC" = "adb" ]; then
- adb pull /system/$FILE $BASE/$FILE
+if [ $# -eq 0 ]; then
+ SRC=adb
+else
+ if [ $# -eq 1 ]; then
+ SRC=$1
else
- cp $SRC/system/$FILE $BASE/$FILE
+ 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
+
+# Initialize the helper for device
+setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
-done
+extract "$MY_DIR"/proprietary-files.txt "$SRC"
-./setup-makefiles.sh
+"$MY_DIR"/setup-makefiles.sh
diff --git a/setup-makefiles.sh b/setup-makefiles.sh
index 99d4665..2aeb9f2 100755
--- a/setup-makefiles.sh
+++ b/setup-makefiles.sh
@@ -1,45 +1,6 @@
#!/bin/bash
-
-VENDOR=lge
-DEVICE=mako
-OUTDIR=vendor/$VENDOR/$DEVICE
-MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
-
-(cat << EOF) > $MAKEFILE
-# Copyright (C) 2014 The CyanogenMod Project
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-
-PRODUCT_COPY_FILES += \\
-EOF
-
-LINEEND=" \\"
-COUNT=`cat proprietary-blobs.txt | grep -v ^# | grep -v ^$ | wc -l | awk {'print $1'}`
-for FILE in `cat proprietary-blobs.txt | grep -v ^# | grep -v ^$ `; do
- COUNT=`expr $COUNT - 1`
- if [ $COUNT = "0" ]; then
- LINEEND=""
- fi
- if [[ ! "$FILE" =~ ^-.* ]]; then
- FILE=`echo $FILE | sed -e "s/^-//g"`
- echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
- fi
-done
-
-(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
-# Copyright (C) 2014 The CyanogenMod Project
+# Copyright (C) 2017 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -52,11 +13,34 @@ done
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+#
+
+set -e
+
+DEVICE=mako
+VENDOR=lge
+
+# Load extract_utils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
+
+CM_ROOT="$MY_DIR"/../../..
+
+HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
+ exit 1
+fi
+. "$HELPER"
+
+# Initialize the helper for device
+setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
+# Copyright headers and guards
+write_headers
-# Pick up overlay for features that depend on non-open-source files
-DEVICE_PACKAGE_OVERLAYS := vendor/$VENDOR/$DEVICE/overlay
+# The device blobs
+write_makefiles "$MY_DIR"/proprietary-files.txt
-\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk)
-EOF
+# We are done with device
+write_footers