From: Stricted Date: Wed, 2 May 2018 17:33:36 +0000 (+0200) Subject: update extract scripts X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8d9f5ac0a80d3b0700b6b52e5bbfbca8e86ccf4b;p=GitHub%2Fmt8127%2Fandroid_device_alcatel_ttab.git update extract scripts Change-Id: I1562f4430a653e0c5a9b9957d1325e2a8dd9f7a8 --- diff --git a/extract-files.sh b/extract-files.sh index 79223d1..7d24aff 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -1,39 +1,36 @@ #!/bin/bash +# +# Copyright (C) 2018 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=alcatel DEVICE=ttab -function extract() { - for FILE in `egrep -v '(^#|^$)' $1`; do - OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS - FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"` - DEST=${PARSING_ARRAY[1]} - if [ -z $DEST ]; then - DEST=$FILE - fi - DIR=`dirname $FILE` - if [ ! -d $2/$DIR ]; then - mkdir -p $2/$DIR - fi - if [ "$SRC" = "adb" ]; then - # Try CM target first - adb pull /system/$DEST $2/$DEST - # if file does not exist try OEM target - if [ "$?" != "0" ]; then - adb pull /system/$FILE $2/$DEST - fi - else - cp $SRC/system/$FILE $2/$DEST - # if file dot not exist try destination - if [ "$?" != "0" ] - then - cp $SRC/system/$DEST $2/$DEST - fi - fi - done -} +# Load extractutils and do some sanity checks +MY_DIR="${BASH_SOURCE%/*}" +if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi + +LINEAGE_ROOT="$MY_DIR"/../../.. + +HELPER="$LINEAGE_ROOT"/vendor/cm/build/tools/extract_utils.sh +if [ ! -f "$HELPER" ]; then + echo "Unable to find helper script at $HELPER" + exit 1 +fi +. "$HELPER" if [ $# -eq 0 ]; then SRC=adb @@ -51,9 +48,9 @@ else fi fi -DEVBASE=../../../vendor/$VENDOR/$DEVICE/proprietary -rm -rf $DEVBASE/* +# Initialize the helper +setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" true -extract ../../$VENDOR/$DEVICE/proprietary-files.txt $DEVBASE +extract "$MY_DIR"/proprietary-files.txt "$SRC" -./setup-makefiles.sh \ No newline at end of file +"$MY_DIR"/setup-makefiles.sh diff --git a/setup-makefiles.sh b/setup-makefiles.sh index 265b124..fbff31d 100755 --- a/setup-makefiles.sh +++ b/setup-makefiles.sh @@ -1,13 +1,5 @@ #!/bin/bash - -VENDOR=alcatel -DEVICE=ttab -OUTDIR=vendor/$VENDOR/$DEVICE -MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk - -(cat << EOF) > $MAKEFILE -# Copyright (C) 2013-2016, The CyanogenMod Project -# Copyright (C) 2017, The LineageOS 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. @@ -21,72 +13,32 @@ MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk # 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 +set -e -LOCAL_PATH := vendor/$VENDOR/$DEVICE - -PRODUCT_COPY_FILES += \\ -EOF - -LINEEND=" \\" -COUNT=`wc -l proprietary-files.txt | awk {'print $1'}` -DISM=`egrep -c '(^#|^$)' proprietary-files.txt` -COUNT=`expr $COUNT - $DISM` -for FILE in `egrep -v '(^#|^$)' ../$DEVICE/proprietary-files.txt`; do - COUNT=`expr $COUNT - 1` - if [ $COUNT = "0" ]; then - LINEEND="" - fi - # 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 [ -n "$DEST" ]; then - FILE=$DEST - fi - echo " \$(LOCAL_PATH)/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE -done +VENDOR=alcatel +DEVICE=ttab -(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk -# Copyright (C) 2013-2016, 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. -# 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. +# Load extractutils and do some sanity checks +MY_DIR="${BASH_SOURCE%/*}" +if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh +LINEAGE_ROOT="$MY_DIR"/../../.. -# Pick up overlay for features that depend on non-open-source files -DEVICE_PACKAGE_OVERLAYS := vendor/$VENDOR/$DEVICE/overlay +HELPER="$LINEAGE_ROOT"/vendor/cm/build/tools/extract_utils.sh +if [ ! -f "$HELPER" ]; then + echo "Unable to find helper script at $HELPER" + exit 1 +fi +. "$HELPER" -\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk) -EOF +# Initialize the helper +setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" true -(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk -# Copyright (C) 2013-2016, 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. -# 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. +# Copyright headers and guards +write_headers "ttab" -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh +# The standard blobs +write_makefiles "$MY_DIR"/proprietary-files.txt -EOF \ No newline at end of file +# Done +write_footers