From c55eb8a0c3ca5b8ed1081e7eb8a423563288fb58 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Thu, 20 Feb 2020 06:58:11 +0000 Subject: use local scope for private function vars all vars affected have been carefully checked to be quite certain that they are definitely local where variable is assigned the return value of a function/command, the local "declaration" is deliberately done on a separate line, since `local FOO` is actually treated itself as a command rather than a declaration; will thus always cause $? to be zero, and thus if done on the same line as such an assignment can not only clobber $? but in doing so unintentionally blocks failure of a command from triggering the expected exit from having `set -e`. also, from testing, i have found that when assigning "${@}" this must be done on a separate line confusingly as otherwise an error occurs. Gbp-Dch: Short --- scripts/build/binary_hdd | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/build/binary_hdd') diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd index a4d907fdd..bc9c61672 100755 --- a/scripts/build/binary_hdd +++ b/scripts/build/binary_hdd @@ -287,6 +287,8 @@ find /live/vmlinuz EOM EOF + local rootpartition + local hdddev rootpartition="$(Chroot chroot 'sh grub.sh' 2>/dev/null | grep -A 1 'find /live/vmlinuz' | grep -v 'find /live/vmlinuz')" hdddev="$(echo $rootpartition | sed -e 's|,[[:digit:]]||')" echo "Root partition is $rootpartition, device is: $hdddev" -- cgit v1.2.3