From 58319ff3a4a0df2051ba9562b481fdd718e4e309 Mon Sep 17 00:00:00 2001 From: ale5000 <15793015+ale5000-git@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:08:59 +0200 Subject: [PATCH] Minor improvements --- zip-content/inc/common-functions.sh | 27 +++++++++++++++++++++++++++ zip-content/scripts/install.sh | 18 ------------------ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/zip-content/inc/common-functions.sh b/zip-content/inc/common-functions.sh index ba53c85c..662b4050 100644 --- a/zip-content/inc/common-functions.sh +++ b/zip-content/inc/common-functions.sh @@ -413,6 +413,29 @@ _detect_architectures() export ARCH_X64 ARCH_X86 ARCH_ARM64 ARCH_ARM ARCH_LEGACY_ARM } +_detect_main_architectures() +{ + CPU64='false' + CPU='false' + + if test "${ARCH_X64:?}" = 'true'; then + CPU64='x86_64' + elif test "${ARCH_ARM64:?}" = 'true'; then + CPU64='arm64-v8a' + fi + + if test "${ARCH_X86:?}" = 'true'; then + CPU='x86' + elif test "${ARCH_ARM:?}" = 'true'; then + CPU='armeabi-v7a' + elif test "${ARCH_LEGACY_ARM:?}" = 'true'; then + CPU='armeabi' + fi + + readonly CPU64 CPU + export CPU64 CPU +} + _generate_architectures_list() { ARCH_LIST='' @@ -432,6 +455,7 @@ _generate_architectures_list() if test "${ARCH_LEGACY_ARM:?}" = 'true'; then ARCH_LIST="${ARCH_LIST?}armeabi," fi + ARCH_LIST="${ARCH_LIST%,}" readonly ARCH_LIST export ARCH_LIST @@ -453,6 +477,8 @@ display_info() ui_msg "Recovery API ver: ${RECOVERY_API_VER:-}" ui_msg_empty_line ui_msg "Android API: ${API:?}" + ui_msg "64-bit CPU arch: ${CPU64:?}" + ui_msg "32-bit CPU arch: ${CPU:?}" ui_msg "CPU arch list: ${ARCH_LIST?}" } @@ -640,6 +666,7 @@ initialize() export ABI_LIST _detect_architectures + _detect_main_architectures _generate_architectures_list unset LAST_MOUNTPOINT diff --git a/zip-content/scripts/install.sh b/zip-content/scripts/install.sh index e93b0c28..93ad4a4f 100644 --- a/zip-content/scripts/install.sh +++ b/zip-content/scripts/install.sh @@ -25,8 +25,6 @@ unset CDPATH TMP_PATH="${2:?}" -CPU=false -CPU64=false LEGACY_ARM=false FAKE_SIGN=false @@ -62,24 +60,8 @@ else ui_error 'Invalid API level' fi -if is_substring ',x86,' "${ABI_LIST}"; then - CPU='x86' -elif is_substring ',armeabi-v7a,' "${ABI_LIST}"; then - CPU='armeabi-v7a' -elif is_substring ',armeabi,' "${ABI_LIST}"; then - CPU='armeabi' -fi - -if is_substring ',x86_64,' "${ABI_LIST}"; then - CPU64='x86_64' -elif is_substring ',arm64-v8a,' "${ABI_LIST}"; then - CPU64='arm64-v8a' -fi - # Display info display_info -ui_msg "Main 64-bit CPU arch: ${CPU64:?}" -ui_msg "Main 32-bit CPU arch: ${CPU:?}" ui_msg_empty_line ui_msg "Verity mode: ${VERITY_MODE:-disabled}" ui_msg "Dynamic partitions: ${DYNAMIC_PARTITIONS:?}"