3 # Copyright (C) 2016 The CyanogenMod Project
4 # Copyright (C) 2017-2023 The LineageOS Project
6 # SPDX-License-Identifier: Apache-2.0
11 # Load extract_utils and do some sanity checks
12 MY_DIR
="${BASH_SOURCE%/*}"
13 if [[ ! -d "${MY_DIR}" ]]; then MY_DIR
="${PWD}"; fi
15 ANDROID_ROOT
="${MY_DIR}/../../.."
17 HELPER
="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
18 if [ ! -f "${HELPER}" ]; then
19 echo "Unable to find helper script at ${HELPER}"
24 # Default to sanitizing the vendor folder before extraction
33 while [ "${#}" -gt 0 ]; do
61 if [ -z "${SRC}" ]; then
65 function blob_fixup
() {
67 vendor
/etc
/init
/fs.rc
)
68 sed -i '/media 0770 media_rw media_rw/d' "${2}"
69 sed -i '/setprop ro.crypto.fuse_sdcard true/d' "${2}"
71 vendor
/etc
/init
/tee-supplicant.rc
)
72 sed -i s
#/vendor/lib/#/vendor/lib/modules/#g "${2}"
77 if [ -z "${ONLY_FIRMWARE}" ] && [ -z "${ONLY_TARGET}" ]; then
78 # Initialize the helper for common device
79 setup_vendor
"${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
81 extract
"${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
82 extract
"${MY_DIR}/proprietary-files-atv.txt" "${SRC}" "${KANG}" --section "${SECTION}"
83 extract
"${MY_DIR}/proprietary-files-tee.txt" "${SRC}" "${KANG}" --section "${SECTION}"
86 if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
87 # Reinitialize the helper for device
88 source "${MY_DIR}/../../${VENDOR}/${DEVICE}/extract-files.sh"
89 setup_vendor
"${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
91 if [ -z "${ONLY_FIRMWARE}" ]; then
92 extract
"${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
95 if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
96 extract_firmware
"${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" "${SRC}"
100 "${MY_DIR}/setup-makefiles.sh"