summaryrefslogtreecommitdiff
path: root/scripts/build/config
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 /scripts/build/config
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 'scripts/build/config')
-rwxr-xr-xscripts/build/config4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/build/config b/scripts/build/config
index 1d0c150ff..2b9ff701c 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -137,6 +137,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
Local_arguments ()
{
+ local LONG_OPTIONS
LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-options:,aptitude-options:,debootstrap-options:,debootstrap-script:,
apt-pipeline:,apt-recommends:,apt-secure:,apt-source-archives:,cache:,cache-indices:,cache-packages:,
cache-stages:,debconf-frontend:,debconf-priority:,dump,
@@ -165,6 +166,7 @@ Local_arguments ()
# Remove spaces added by indentation
LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
+ local ARGUMENTS
local ERR=0
ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:d:m:k:b:s:c:huv --shell sh -- "${@}")" || ERR=$?
@@ -183,6 +185,7 @@ Local_arguments ()
case "${1}" in
--dump)
# Dump version
+ local VERSION_DPKG
if [ $(which dpkg-query) ]
then
VERSION_DPKG="$(dpkg-query -f='${Version}' --show live-build)"
@@ -194,6 +197,7 @@ Local_arguments ()
Print_conffiles $(Common_config_files)
# Dump contents of directories that contain text files
+ local DIRECTORY
for DIRECTORY in config/package-lists config/apt config/preseed config/rootfs
do
if Find_files "${DIRECTORY}"