From ff49ad926fe5e79939da5e1dca4ff5175547c32a Mon Sep 17 00:00:00 2001 From: Ellie <64124388+ell1e@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:15:32 +0200 Subject: [PATCH] Attempt to repair maple_upload for non-dpkg systems --- Bin/uconsole_keyboard_flash/maple_upload | 41 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Bin/uconsole_keyboard_flash/maple_upload b/Bin/uconsole_keyboard_flash/maple_upload index eb1998c..6b038c8 100755 --- a/Bin/uconsole_keyboard_flash/maple_upload +++ b/Bin/uconsole_keyboard_flash/maple_upload @@ -2,19 +2,42 @@ #set -e -architecture="unknow" +have_dpkg="no" +dpkg --version > /dev/null 2>&1 +if [ "x$?" = x0 ]; then + have_dpkg="yes" +fi +dpkg_indicates_arm64="no" +if [ "$have_dpkg" = "yes" ]; then + dpkg_arch_output="`dpkg --print architecture`" + echo "$dpkg_arch_output" | grep -q "arm64" + if [ "x$?" = x0 ]; then + dpkg_indicates_arm64="yes" + fi +fi + +architecture="unknown" case $(uname -m) in x86_64) architecture="amd64" ;; - armv7l) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;; - arm) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;; + armv7l) + if [ "$dpkg_indicates_arm64" = "yes" ]; then + architecture="aarch64" + else + architecture="armhf" + fi;; + arm) + if [ "$dpkg_indicates_arm64" = "yes" ]; then + architecture="aarch64" + else + architecture="armhf" + fi;; aarch64) architecture="aarch64";; riscv64) architecture="riscv64";; esac - -if [ $architecture = "unknow" ]; then - echo "unknow architecture,exiting..." - exit +if [ $architecture = "unknown" ]; then + echo "unknown architecture,exiting..." + exit fi @@ -62,7 +85,9 @@ echo "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R echo -n Waiting for ${dummy_port_fullpath} serial... -dpkg --print-architecture +if [ "$have_dpkg" = "yes" ]; then + dpkg --print-architecture +fi COUNTER=0 while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do sleep 0.2