From a05fdf8e7133eb3f9aa57050649a283eefd574b1 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 17 Jan 2021 12:31:55 +0100 Subject: [PATCH] setup_busybox () fix compat with TWRP that uses busybox instead of toolbox --- CommonInstaller | 9 +++++---- patcher/CommonPatcher | 9 +++++---- systest/SysTest | 9 +++++---- uninstaller/META-INF/com/google/android/update-binary | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CommonInstaller b/CommonInstaller index d9dee907..1d7c2121 100644 --- a/CommonInstaller +++ b/CommonInstaller @@ -881,10 +881,11 @@ nanodroid_finalize () { ########################################################################################## setup_busybox () { - if [[ "$(uname -m)" == a* ]]; then - local bb_arch=arm - else local bb_arch=x86 - fi + case $(uname -m) in + arm* ) local bb_arch=arm ;; + x86* ) local bb_arch=x86 ;; + * ) error "arch \"$(uname -m)\" is not supported" + esac mkdir -p ${INSTALLER}/busybox ln -s ${INSTALLER}/busybox.${bb_arch} ${INSTALLER}/busybox/busybox diff --git a/patcher/CommonPatcher b/patcher/CommonPatcher index cf087515..e19184da 100644 --- a/patcher/CommonPatcher +++ b/patcher/CommonPatcher @@ -332,10 +332,11 @@ detect_odex () { ########################################################################################## setup_busybox () { - if [[ "$(uname -m)" == a* ]]; then - local bb_arch=arm - else local bb_arch=x86 - fi + case $(uname -m) in + arm* ) local bb_arch=arm ;; + x86* ) local bb_arch=x86 ;; + * ) error "arch \"$(uname -m)\" is not supported" + esac if [ -f ${TMPDIR}/busybox.${bb_arch} ]; then BUSY=${TMPDIR}/busybox.${bb_arch} diff --git a/systest/SysTest b/systest/SysTest index 4ad90118..73c3c47f 100644 --- a/systest/SysTest +++ b/systest/SysTest @@ -313,10 +313,11 @@ grep_cmdline() { } setup_busybox () { - if [[ "$(uname -m)" == a* ]]; then - local bb_arch=arm - else local bb_arch=x86 - fi + case $(uname -m) in + arm* ) local bb_arch=arm ;; + x86* ) local bb_arch=x86 ;; + * ) error "arch \"$(uname -m)\" is not supported" + esac mkdir -p ${TMPDIR}/busybox ln -s ${TMPDIR}/busybox.${bb_arch} ${TMPDIR}/busybox/busybox diff --git a/uninstaller/META-INF/com/google/android/update-binary b/uninstaller/META-INF/com/google/android/update-binary index 53e4d5ad..b8d270d2 100644 --- a/uninstaller/META-INF/com/google/android/update-binary +++ b/uninstaller/META-INF/com/google/android/update-binary @@ -65,10 +65,11 @@ setup_busybox () { unzip -oq "${ZIP}" busybox.arm -d "/dev/tmp" unzip -oq "${ZIP}" busybox.x86 -d "/dev/tmp" - if [[ "$(uname -m)" == a* ]]; then - local bb_arch=arm - else local bb_arch=x86 - fi + case $(uname -m) in + arm* ) local bb_arch=arm ;; + x86* ) local bb_arch=x86 ;; + * ) error "arch \"$(uname -m)\" is not supported" + esac mkdir -p /dev/tmp/busybox ln -s /dev/tmp/busybox.${bb_arch} /dev/tmp/busybox/busybox