summaryrefslogtreecommitdiff
path: root/scripts/build/installer_debian-installer
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/installer_debian-installer
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/installer_debian-installer')
-rwxr-xr-xscripts/build/installer_debian-installer27
1 files changed, 12 insertions, 15 deletions
diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer
index 343c678ee..5eb935fe6 100755
--- a/scripts/build/installer_debian-installer
+++ b/scripts/build/installer_debian-installer
@@ -151,8 +151,7 @@ case "${LB_ARCHITECTURES}" in
esac
Install_file() {
- local FILE
- FILE="${1}"
+ local FILE="${1}"
Echo_debug "Installing file %s" "${FILE}"
@@ -166,9 +165,9 @@ Install_file() {
ARCHIVE_AREA="main"
fi
- local TARGET
- TARGET="${2}/${ARCHIVE_AREA}"
+ local TARGET="${2}/${ARCHIVE_AREA}"
+ local SOURCE
SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
if [ -z "${SOURCE}" ]
@@ -176,6 +175,7 @@ Install_file() {
SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
fi
+ local LETTER
case "${SOURCE}" in
lib?*)
LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
@@ -198,14 +198,12 @@ Install_file() {
_LB_CACHE_DIR="$(pwd)/cache/installer_debian-installer"
Download_file () {
- local _LB_TARGET
- _LB_TARGET="${1}"
-
- local _LB_URL
- _LB_URL="${2}"
+ local _LB_TARGET="${1}"
+ local _LB_URL="${2}"
Echo_debug "Downloading file \`%s\` from \`%s\`" "${_LB_TARGET}" "${_LB_URL}"
+ local _LB_CACHE_FILE
_LB_CACHE_FILE="${_LB_CACHE_DIR}/$(echo "${_LB_URL}" | sed 's|/|_|g')"
if [ ! -f "${_LB_CACHE_FILE}" ]
@@ -795,11 +793,9 @@ fi
Repack_initrd()
{
- local TARGET_INITRD
- local INCLUDE_PATH
- TARGET_INITRD="${1}"
- INCLUDE_PATH="${2}"
- REPACK_TMPDIR="unpacked-initrd"
+ local TARGET_INITRD="${1}"
+ local INCLUDE_PATH="${2}"
+ local REPACK_TMPDIR="unpacked-initrd"
Echo_debug "Repacking initrd \`%s\`" "${TARGET_INITRD}"
@@ -816,6 +812,7 @@ Repack_initrd()
if [ ! -d "${INCLUDE_PATH}" ]
then
# Invoked the old way, just copy the preseeds
+ local _FILE
for _FILE in ../config/preseed/*.cfg ../config/preseed/*.cfg.installer
do
if [ -e "${_FILE}" ]
@@ -825,7 +822,7 @@ Repack_initrd()
done
else
# New way, include target directory content in the initrd
- REPACK_TMPDIR_ABS="${PWD}"
+ local REPACK_TMPDIR_ABS="${PWD}"
cd "${INCLUDE_PATH}"
find -print0 | cpio -pumd0 --no-preserve-owner "${REPACK_TMPDIR_ABS}/"
cd "${OLDPWD}"