Skip to content

Commit

Permalink
tomato: Update extract scripts to latest templates
Browse files Browse the repository at this point in the history
* Add support for blob section exctraction
* Cleanup

Change-Id: Ia6404e7fe64e5682ef628f4839a544fd1b76b6c2
  • Loading branch information
mikeNG committed Jul 31, 2017
1 parent d3806ec commit ebbeec8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
41 changes: 24 additions & 17 deletions extract-files.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
#
# Copyright (C) 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
# 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,
Expand All @@ -20,7 +21,7 @@ set -e
DEVICE=tomato
VENDOR=yu

# Load extractutils and do some sanity checks
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi

Expand All @@ -33,25 +34,31 @@ if [ ! -f "$HELPER" ]; then
fi
. "$HELPER"

if [ $# -eq 0 ]; then
# default to not sanitizing the vendor folder before extraction
clean_vendor=false

while [ "$1" != "" ]; do
case $1 in
-p | --path ) shift
SRC=$1
;;
-s | --section ) shift
SECTION=$1
clean_vendor=false
;;
-c | --clean-vendor ) clean_vendor=true
;;
esac
shift
done

if [ -z "$SRC" ]; 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."
exit 1
fi
fi

# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" false $clean_vendor

extract "$MY_DIR"/proprietary-files.txt "$SRC"
extract "$MY_DIR"/proprietary-files.txt "$SRC" "$SECTION"

"$MY_DIR"/setup-makefiles.sh
13 changes: 6 additions & 7 deletions setup-makefiles.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
#
# Copyright (C) 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
# 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,
Expand All @@ -17,13 +18,12 @@

set -e

export INITIAL_COPYRIGHT_YEAR=2015

# Required!
DEVICE=tomato
VENDOR=yu

# Load extractutils and do some sanity checks
INITIAL_COPYRIGHT_YEAR=2015

# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi

Expand All @@ -42,8 +42,7 @@ setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
# Copyright headers and guards
write_headers

# The standard blobs
write_makefiles "$MY_DIR"/proprietary-files.txt

# We are done!
# Finish
write_footers

0 comments on commit ebbeec8

Please sign in to comment.