summaryrefslogtreecommitdiff
path: root/functions/packages.sh
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-02-20 06:58:11 +0000
committerLyndon Brown <jnqnfe@gmail.com>2020-03-16 22:10:03 +0000
commitc55eb8a0c3ca5b8ed1081e7eb8a423563288fb58 (patch)
tree6ea61f7291b27ce9e22b40c5593c6ab6f54555d2 /functions/packages.sh
parentaf040d78035b88aaf2f99f38bf5f0db176c92d0a (diff)
downloadvyos-live-build-c55eb8a0c3ca5b8ed1081e7eb8a423563288fb58.tar.gz
vyos-live-build-c55eb8a0c3ca5b8ed1081e7eb8a423563288fb58.zip
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
Diffstat (limited to 'functions/packages.sh')
-rwxr-xr-xfunctions/packages.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/functions/packages.sh b/functions/packages.sh
index f07bed35f..fa16b1161 100755
--- a/functions/packages.sh
+++ b/functions/packages.sh
@@ -9,11 +9,12 @@
## under certain conditions; see COPYING for details.
+# Note, updates _LB_PACKAGES
Check_package ()
{
- CHROOT="${1}"
- FILE="${2}"
- PACKAGE="${3}"
+ local CHROOT="${1}"
+ local FILE="${2}"
+ local PACKAGE="${3}"
Check_installed "${CHROOT}" "${FILE}" "${PACKAGE}"
@@ -68,9 +69,9 @@ Remove_package ()
# 2 if package isn't installed and we aren't in an apt managed system
Check_installed ()
{
- CHROOT="${1}"
- FILE="${2}"
- PACKAGE="${3}"
+ local CHROOT="${1}"
+ local FILE="${2}"
+ local PACKAGE="${3}"
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] && [ "${CHROOT}" = "chroot" ]
then