diff --git a/extract-files.sh b/extract-files.sh index bfbacc7..4d768cc 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# SPDX-FileCopyrightText: 2016 The CyanogenMod Project +# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -17,6 +17,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi ANDROID_ROOT="${MY_DIR}/../../.." +# If XML files don't have comments before the XML header, use this flag +# Can still be used with broken XML files by using blob_fixup +export TARGET_DISABLE_XML_FIXING=true + HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" if [ ! -f "${HELPER}" ]; then echo "Unable to find helper script at ${HELPER}" @@ -32,19 +36,20 @@ SECTION= while [ "${#}" -gt 0 ]; do case "${1}" in - -n | --no-cleanup ) - CLEAN_VENDOR=false - ;; - -k | --kang ) - KANG="--kang" - ;; - -s | --section ) - SECTION="${2}"; shift - CLEAN_VENDOR=false - ;; - * ) - SRC="${1}" - ;; + -n | --no-cleanup) + CLEAN_VENDOR=false + ;; + -k | --kang) + KANG="--kang" + ;; + -s | --section) + SECTION="${2}" + shift + CLEAN_VENDOR=false + ;; + *) + SRC="${1}" + ;; esac shift done @@ -58,12 +63,23 @@ setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" function blob_fixup() { case "${1}" in vendor/bin/hw/android.hardware.security.keymint-service-qti|vendor/lib64/libqtikeymint.so) + [ "$2" = "" ] && return 0 grep -q "android.hardware.security.rkp-V3-ndk.so" "${2}" || ${PATCHELF} --add-needed "android.hardware.security.rkp-V3-ndk.so" "${2}" ;; vendor/etc/init/init.batterysecret.rc|vendor/etc/init/init.mi_thermald.rc) + [ "$2" = "" ] && return 0 sed -i 's/on charger/on property:init.svc.vendor.charger=running/g' "${2}" ;; + *) + return 1 + ;; esac + + return 0 +} + +function blob_fixup_dry() { + blob_fixup "$1" "" } extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" diff --git a/setup-makefiles.sh b/setup-makefiles.sh index 6cf9250..3a610f9 100755 --- a/setup-makefiles.sh +++ b/setup-makefiles.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# SPDX-FileCopyrightText: 2016 The CyanogenMod Project +# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 #