Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2016 The CyanogenMod Project |
| 4 | # Copyright (C) 2017 The LineageOS Project |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | |
| 19 | set -e |
| 20 | |
| 21 | DEVICE=**** FILL IN DEVICE NAME **** |
| 22 | VENDOR=*** FILL IN VENDOR **** |
| 23 | |
| 24 | # Load extract_utils and do some sanity checks |
| 25 | MY_DIR="${BASH_SOURCE%/*}" |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 26 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 27 | |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 28 | LINEAGE_ROOT="${MY_DIR}/../../.." |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 29 | |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 30 | HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh" |
| 31 | if [ ! -f "${HELPER}" ]; then |
| 32 | echo "Unable to find helper script at ${HELPER}" |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 33 | exit 1 |
| 34 | fi |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 35 | source "${HELPER}" |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 36 | |
Bruno Martins | 0753ae0 | 2017-08-16 15:55:23 +0000 | [diff] [blame] | 37 | # Default to sanitizing the vendor folder before extraction |
| 38 | CLEAN_VENDOR=true |
Vladimir Oltean | d5d0fea | 2019-01-17 23:41:35 +0200 | [diff] [blame] | 39 | SECTION= |
Vladimir Oltean | bff959a | 2019-01-17 23:46:23 +0200 | [diff] [blame] | 40 | KANG= |
Rashed Abdel-Tawab | 58ce825 | 2017-07-30 14:09:24 -0400 | [diff] [blame] | 41 | |
| 42 | while [ "$1" != "" ]; do |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 43 | case "$1" in |
Paul Keith | d402d12 | 2017-09-03 03:53:04 +0200 | [diff] [blame] | 44 | -n | --no-cleanup ) CLEAN_VENDOR=false |
Rashed Abdel-Tawab | 58ce825 | 2017-07-30 14:09:24 -0400 | [diff] [blame] | 45 | ;; |
Vladimir Oltean | bff959a | 2019-01-17 23:46:23 +0200 | [diff] [blame] | 46 | -k | --kang) KANG="--kang" |
| 47 | ;; |
Rashed Abdel-Tawab | 58ce825 | 2017-07-30 14:09:24 -0400 | [diff] [blame] | 48 | -s | --section ) shift |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 49 | SECTION="$1" |
Bruno Martins | 0753ae0 | 2017-08-16 15:55:23 +0000 | [diff] [blame] | 50 | CLEAN_VENDOR=false |
Rashed Abdel-Tawab | 58ce825 | 2017-07-30 14:09:24 -0400 | [diff] [blame] | 51 | ;; |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 52 | * ) SRC="$1" |
Rashed Abdel-Tawab | 58ce825 | 2017-07-30 14:09:24 -0400 | [diff] [blame] | 53 | ;; |
| 54 | esac |
| 55 | shift |
| 56 | done |
| 57 | |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 58 | if [ -z "${SRC}" ]; then |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 59 | SRC=adb |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 60 | fi |
| 61 | |
| 62 | # Initialize the helper |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 63 | setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false "${CLEAN_VENDOR}" |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 64 | |
Vladimir Oltean | bff959a | 2019-01-17 23:46:23 +0200 | [diff] [blame] | 65 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" ${KANG} --section "${SECTION}" |
Christopher R. Palmer | 070fcfc | 2017-03-03 09:27:58 -0500 | [diff] [blame] | 66 | |
Vladimir Oltean | 4931a06 | 2019-01-17 23:35:59 +0200 | [diff] [blame] | 67 | "${MY_DIR}/setup-makefiles.sh" |