Alexander Martinz | bcf6d67 | 2021-08-26 17:27:03 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2016 The CyanogenMod Project |
| 4 | # Copyright (C) 2017-2020 The LineageOS Project |
| 5 | # |
| 6 | # SPDX-License-Identifier: Apache-2.0 |
| 7 | # |
| 8 | |
| 9 | set -e |
| 10 | |
| 11 | DEVICE=axolotl |
| 12 | VENDOR=shift |
| 13 | |
| 14 | # Load extract_utils and do some sanity checks |
| 15 | MY_DIR="${BASH_SOURCE%/*}" |
| 16 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi |
| 17 | |
| 18 | ANDROID_ROOT="${MY_DIR}/../../.." |
| 19 | |
| 20 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" |
| 21 | if [ ! -f "${HELPER}" ]; then |
| 22 | echo "Unable to find helper script at ${HELPER}" |
| 23 | exit 1 |
| 24 | fi |
| 25 | source "${HELPER}" |
| 26 | |
| 27 | # Default to sanitizing the vendor folder before extraction |
| 28 | CLEAN_VENDOR=true |
| 29 | |
| 30 | KANG= |
| 31 | SECTION= |
| 32 | |
| 33 | while [ "${#}" -gt 0 ]; do |
| 34 | case "${1}" in |
| 35 | -n | --no-cleanup ) |
| 36 | CLEAN_VENDOR=false |
| 37 | ;; |
| 38 | -k | --kang ) |
| 39 | KANG="--kang" |
| 40 | ;; |
| 41 | -s | --section ) |
| 42 | SECTION="${2}"; shift |
| 43 | CLEAN_VENDOR=false |
| 44 | ;; |
| 45 | * ) |
| 46 | SRC="${1}" |
| 47 | ;; |
| 48 | esac |
| 49 | shift |
| 50 | done |
| 51 | |
| 52 | if [ -z "${SRC}" ]; then |
| 53 | SRC="adb" |
| 54 | fi |
| 55 | |
| 56 | function blob_fixup() { |
| 57 | case "${1}" in |
Alexander Martinz | 6cf7e9e | 2023-01-18 12:09:37 +0100 | [diff] [blame] | 58 | system_ext/lib64/lib-imsvideocodec.so) |
| 59 | grep -q "libgui_shim.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim.so" "${2}" |
| 60 | grep -q "libui_shim.so" "${2}" || "${PATCHELF}" --add-needed "libui_shim.so" "${2}" |
| 61 | ;; |
Alexander Martinz | bcf6d67 | 2021-08-26 17:27:03 +0200 | [diff] [blame] | 62 | vendor/lib64/hw/camera.qcom.so) |
Alexander Martinz | a159f24 | 2023-09-27 14:40:09 +0200 | [diff] [blame] | 63 | grep -q "libcomparetf2_shim.so" "${2}" || "${PATCHELF}" --add-needed "libcomparetf2_shim.so" "${2}" |
Alexander Martinz | bcf6d67 | 2021-08-26 17:27:03 +0200 | [diff] [blame] | 64 | ;; |
Alexander Martinz | 1787af9 | 2023-09-27 17:13:12 +0200 | [diff] [blame] | 65 | vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so) |
| 66 | grep -q "libhidlbase-v32.so" "${2}" || "${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v32.so" "${2}" |
| 67 | ;; |
Alexander Martinz | bcf6d67 | 2021-08-26 17:27:03 +0200 | [diff] [blame] | 68 | esac |
| 69 | } |
| 70 | |
| 71 | # Initialize the helper |
| 72 | setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" |
| 73 | |
| 74 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" |
Alexander Martinz | bf6dd3f | 2022-12-19 23:13:42 +0100 | [diff] [blame] | 75 | extract "${MY_DIR}/proprietary-files-widevine.txt" "${SRC}" "${KANG}" --section "${SECTION}" |
Alexander Martinz | bcf6d67 | 2021-08-26 17:27:03 +0200 | [diff] [blame] | 76 | |
| 77 | "${MY_DIR}/setup-makefiles.sh" |