summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-04 23:11:27 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-04 23:21:44 +0100
commit08c86dc8ace433bd1efacc807357dc92661510ab (patch)
treec0123cb05c2723025882e8611acedbde918ff67c /functions
parenta542d52141acef0e2d2bb78253d6b5df4305dcd1 (diff)
downloadvyos-live-build-08c86dc8ace433bd1efacc807357dc92661510ab.tar.gz
vyos-live-build-08c86dc8ace433bd1efacc807357dc92661510ab.zip
arches: fix some Check_architectures() mess
- the comparison with LB_ARCHITECTURE seems to be based upon an old idea of it potentially being intended in the past to hold more than one arch (when it's name as also plural), but it in fact only holds one. - similarly LB_BOOTSTRAP_QEMU_ARCHITECTURE is singular, so the comparison with the set of params is bad. - storing $@ in a variable before then looping is not a good idea - script name was not being passed to the warnings - can simplify by just returning in the valid case i'm very suspicious about the correctness of the qemu bits, but that can wait for now. Gbp-Dch: Short
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/architectures.sh53
1 files changed, 22 insertions, 31 deletions
diff --git a/functions/architectures.sh b/functions/architectures.sh
index 62b7b15d7..b7f8b979c 100755
--- a/functions/architectures.sh
+++ b/functions/architectures.sh
@@ -11,43 +11,34 @@
Check_architectures ()
{
- local ARCHITECTURES
- ARCHITECTURES="${@}" #must be on separate line to 'local' declaration to avoid error
- local VALID=false
-
local ARCHITECTURE
- for ARCHITECTURE in ${ARCHITECTURES}
+ for ARCHITECTURE in "${@}"
do
- if [ "$(echo ${LB_ARCHITECTURE} | grep ${ARCHITECTURE})" ]
- then
- VALID=true
- break
- fi
- done
-
- if [ "${ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]
- then
- VALID=true
-
- if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
+ if [ "${ARCHITECTURE}" = "${LB_ARCHITECTURE}" ]
then
- Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} was not found"
- VALID=false
+ return
fi
- if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
+ if [ "${ARCHITECTURE}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]
then
- Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
- VALID=false
+ if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
+ then
+ Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} was not found" "${0}"
+ continue
+ fi
+
+ if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
+ then
+ Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable" "${0}"
+ continue
+ fi
+
+ return
fi
+ done
- fi
-
- if ! $VALID
- then
- Echo_warning "skipping %s, foreign architecture(s)." "${0}"
- exit 0
- fi
+ Echo_warning "skipping %s, foreign architecture(s)." "${0}"
+ exit 0
}
Check_crossarchitectures ()
@@ -80,13 +71,13 @@ Check_crossarchitectures ()
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
then
- Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} was not found"
+ Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURE} was not found" "${0}"
exit 0
fi
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
then
- Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
+ Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable" "${0}"
exit 0
fi
return