troika: Sync extract scripts with templates lineage-21
authorMichael Bestas <mkbestas@lineageos.org>
Tue, 27 Aug 2024 19:51:30 +0000 (22:51 +0300)
committerNolen Johnson <johnsonnolen@gmail.com>
Thu, 5 Sep 2024 04:43:04 +0000 (00:43 -0400)
Change-Id: I98a36854c5a0c0390592911bb2558b34eff77efc

extract-files.sh

index ef20ed8a09f6c54c7b4c0e967d9a39240ffa281e..a140589e790977eb93e0963b85fd925957e61690 100755 (executable)
@@ -1,23 +1,34 @@
 #!/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
 #
 
 function blob_fixup() {
     case "${1}" in
-         # Missing libutils symbols
-         vendor/lib*/sensors.chub.so|vendor/lib*/hw/sensors.troika_sprout.so)
-             "${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
-             ;;
-         # Remove libhidltransport/libhwbinder dependencies
-         vendor/lib*/libril_sitril.so)
-             "${PATCHELF}" --remove-needed "libhidltransport.so" "${2}"
-             "${PATCHELF}" --remove-needed "libhwbinder.so" "${2}"
-             ;;
+        # Missing libutils symbols
+        vendor/lib*/sensors.chub.so|vendor/lib*/hw/sensors.troika_sprout.so)
+            [ "$2" = "" ] && return 0
+            "${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
+            ;;
+        # Remove libhidltransport/libhwbinder dependencies
+        vendor/lib*/libril_sitril.so)
+            [ "$2" = "" ] && return 0
+            "${PATCHELF}" --remove-needed "libhidltransport.so" "${2}"
+            "${PATCHELF}" --remove-needed "libhwbinder.so" "${2}"
+            ;;
+        *)
+            return 1
+            ;;
     esac
+
+    return 0
+}
+
+function blob_fixup_dry() {
+    blob_fixup "$1" ""
 }
 
 # If we're being sourced by the common script that we called,