blob: fede67095bd3144cf89b51a38e5b085c9dde6e25 [file] [log] [blame]
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -05001#!/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
19set -e
20
21DEVICE=**** FILL IN DEVICE NAME ****
22VENDOR=*** FILL IN VENDOR ****
23
24# Load extract_utils and do some sanity checks
25MY_DIR="${BASH_SOURCE%/*}"
Vladimir Oltean4931a062019-01-17 23:35:59 +020026if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050027
Vladimir Oltean4931a062019-01-17 23:35:59 +020028LINEAGE_ROOT="${MY_DIR}/../../.."
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050029
Vladimir Oltean4931a062019-01-17 23:35:59 +020030HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh"
31if [ ! -f "${HELPER}" ]; then
32 echo "Unable to find helper script at ${HELPER}"
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050033 exit 1
34fi
Vladimir Oltean4931a062019-01-17 23:35:59 +020035source "${HELPER}"
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050036
Bruno Martins0753ae02017-08-16 15:55:23 +000037# Default to sanitizing the vendor folder before extraction
38CLEAN_VENDOR=true
Vladimir Olteand5d0fea2019-01-17 23:41:35 +020039SECTION=
Vladimir Olteanbff959a2019-01-17 23:46:23 +020040KANG=
Rashed Abdel-Tawab58ce8252017-07-30 14:09:24 -040041
42while [ "$1" != "" ]; do
Vladimir Oltean4931a062019-01-17 23:35:59 +020043 case "$1" in
Paul Keithd402d122017-09-03 03:53:04 +020044 -n | --no-cleanup ) CLEAN_VENDOR=false
Rashed Abdel-Tawab58ce8252017-07-30 14:09:24 -040045 ;;
Vladimir Olteanbff959a2019-01-17 23:46:23 +020046 -k | --kang) KANG="--kang"
47 ;;
Rashed Abdel-Tawab58ce8252017-07-30 14:09:24 -040048 -s | --section ) shift
Vladimir Oltean4931a062019-01-17 23:35:59 +020049 SECTION="$1"
Bruno Martins0753ae02017-08-16 15:55:23 +000050 CLEAN_VENDOR=false
Rashed Abdel-Tawab58ce8252017-07-30 14:09:24 -040051 ;;
Vladimir Oltean4931a062019-01-17 23:35:59 +020052 * ) SRC="$1"
Rashed Abdel-Tawab58ce8252017-07-30 14:09:24 -040053 ;;
54 esac
55 shift
56done
57
Vladimir Oltean4931a062019-01-17 23:35:59 +020058if [ -z "${SRC}" ]; then
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050059 SRC=adb
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050060fi
61
62# Initialize the helper
Vladimir Oltean4931a062019-01-17 23:35:59 +020063setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false "${CLEAN_VENDOR}"
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050064
Vladimir Olteanbff959a2019-01-17 23:46:23 +020065extract "${MY_DIR}/proprietary-files.txt" "${SRC}" ${KANG} --section "${SECTION}"
Christopher R. Palmer070fcfc2017-03-03 09:27:58 -050066
Vladimir Oltean4931a062019-01-17 23:35:59 +020067"${MY_DIR}/setup-makefiles.sh"