Cc: tech-userlevel@NetBSD.org...

Thanks for the tool, needed to apply this patch to upgrade an aarch64
head vm on qemu. There are some more warnings/errors flagged by
shellcheck, attempted to fix a few...

# nbupgrade -r head

--- nbupgrade.sh.orig   2024-05-01 08:32:33.026017291 +0530
+++ nbupgrade.sh        2024-05-01 09:36:30.592833305 +0530
@@ -43,8 +43,6 @@
 KERNEL_VER=$(uname -v | cut -d' ' -f2) || exit 1
 KERNEL_VER_MAJOR=$(uname -v | cut -d' ' -f2 | cut -d. -f1) || exit 1
 KERNEL_NAME=$(sysctl -n kern.configname) || exit 1
-MACHINE=$(uname -m) || exit 1
-MACHINE_ARCH=$(uname -p) || exit 1
 RELEASEDIR=https://cdn.netbsd.org/pub/NetBSD
 RELEASEDIR_DAILY=https://nycdn.netbsd.org/pub/NetBSD-daily
 EXTRA_SETS=""
@@ -62,7 +60,7 @@
 
 do_wait() {
        printf "You have five seconds to cancel with Ctrl+C.\n"
-       for i in 1 2 3 4 5;
+       for _i in 1 2 3 4 5;
        do
                sleep 1
                printf "."
@@ -136,7 +134,7 @@
 }
 
 fetch_kernel_sets() {
-       for set in "${KERNEL_SETS}"; do
+       for set in ${KERNEL_SETS}; do
                if [ -e "/etc/mtree/set.${set}" ]; then
                        fetch_set "${set}" || exit 1
                fi
@@ -313,7 +311,7 @@
        printf "Emptying nbupgrade cache...\n"
        printf "===========================\n"
        printf "\n"
-       rm -rf ${UPGRADE_CACHE}/*
+       rm -rf ${UPGRADE_CACHE:?}/*
 }
 
 if [ "$(id -u)" != 0 ]; then
@@ -322,7 +320,7 @@
 fi
 
 if uname -m | grep -E -q "^(evbarm|evbmips|evbsh3)"; then
-       ARCH_DIR=$(uname -m)-$(uname -a)
+       ARCH_DIR=$(uname -m)-$(uname -p)
 else
        ARCH_DIR=$(uname -m)
 fi

Reply via email to