From 42c52e34f479a95a26a341f44948318237cdbbef Mon Sep 17 00:00:00 2001 From: tabris Date: Fri, 24 Oct 2025 00:14:16 -0400 Subject: [PATCH] build framework - MANAGE_ACNG - allow switch to be empty --- lib/functions/rootfs/rootfs-create.sh | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/functions/rootfs/rootfs-create.sh b/lib/functions/rootfs/rootfs-create.sh index dd3e1f1a7..53487bee0 100644 --- a/lib/functions/rootfs/rootfs-create.sh +++ b/lib/functions/rootfs/rootfs-create.sh @@ -50,19 +50,24 @@ function create_new_rootfs_cache_via_debootstrap() { # this is different between debootstrap and regular apt-get; here we use acng as a prefix to the real repo declare debootstrap_apt_mirror="http://${APT_MIRROR}" - if [[ "${MANAGE_ACNG}" == "yes" ]]; then - local debootstrap_apt_mirror="http://localhost:3142/${APT_MIRROR}" - acng_check_status_or_restart - elif [[ "${MANAGE_ACNG}" == "no" ]]; then - : # do nothing - else - if [[ ! "${MANAGE_ACNG}" =~ ^https?:// ]]; then - exit_with_error "MANAGE_ACNG must be yes/no OR be a full URL with http/https" "${MANAGE_ACNG}" - else - # FIXME: although this works with mmdebstrap, there's a more idiomatic way with `--aptopt` - local debootstrap_apt_mirror="${MANAGE_ACNG}/${APT_MIRROR}" - fi - fi + case "${MANAGE_ACNG}" in + yes) + local debootstrap_apt_mirror="http://localhost:3142/${APT_MIRROR}" + acng_check_status_or_restart + ;; + no) ;& # do nothing, fallthrough + "") + : # still do nothing + ;; # stop falling + *) + if [[ ! "${MANAGE_ACNG}" =~ ^https?:// ]]; then + exit_with_error "MANAGE_ACNG must be yes/no OR be a full URL with http/https" "${MANAGE_ACNG}" + else + # FIXME: although this works with mmdebstrap, there's a more idiomatic way with `--aptopt` + local debootstrap_apt_mirror="${MANAGE_ACNG}/${APT_MIRROR}" + fi + ;; + esac # @TODO: one day: https://gitlab.mister-muffin.de/josch/mmdebstrap/src/branch/main/mmdebstrap