Sync extract scripts with templates

Change-Id: I98a36854c5a0c0390592911bb2558b34eff77efc
This commit is contained in:
Michael Bestas 2024-08-27 22:51:30 +03:00 committed by Giovanni Ricca
parent 3801334591
commit cd26b25ddf
No known key found for this signature in database
2 changed files with 33 additions and 19 deletions

View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (C) 2016 The CyanogenMod Project # SPDX-FileCopyrightText: 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project # SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -17,6 +16,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.." 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" HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}" echo "Unable to find helper script at ${HELPER}"
@ -32,19 +35,20 @@ SECTION=
while [ "${#}" -gt 0 ]; do while [ "${#}" -gt 0 ]; do
case "${1}" in case "${1}" in
-n | --no-cleanup ) -n | --no-cleanup)
CLEAN_VENDOR=false CLEAN_VENDOR=false
;; ;;
-k | --kang ) -k | --kang)
KANG="--kang" KANG="--kang"
;; ;;
-s | --section ) -s | --section)
SECTION="${2}"; shift SECTION="${2}"
CLEAN_VENDOR=false shift
;; CLEAN_VENDOR=false
* ) ;;
SRC="${1}" *)
;; SRC="${1}"
;;
esac esac
shift shift
done done
@ -56,12 +60,23 @@ fi
function blob_fixup() { function blob_fixup() {
case "${1}" in case "${1}" in
system/lib64/libcamera_algoup_jni.xiaomi.so|system/lib64/libcamera_mianode_jni.xiaomi.so) system/lib64/libcamera_algoup_jni.xiaomi.so|system/lib64/libcamera_mianode_jni.xiaomi.so)
[ "$2" = "" ] && return 0
grep -q "libgui_shim_miuicamera.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim_miuicamera.so" "${2}" grep -q "libgui_shim_miuicamera.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim_miuicamera.so" "${2}"
;; ;;
system/lib64/libmicampostproc_client.so) system/lib64/libmicampostproc_client.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "libhidltransport.so" "${2}" "${PATCHELF}" --remove-needed "libhidltransport.so" "${2}"
;; ;;
*)
return 1
;;
esac esac
return 0
}
function blob_fixup_dry() {
blob_fixup "$1" ""
} }
# Initialize the helper # Initialize the helper

View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (C) 2016 The CyanogenMod Project # SPDX-FileCopyrightText: 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project # SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #