diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-05-05 19:29:36 +0100 |
---|---|---|
committer | Lyndon Brown <jnqnfe@gmail.com> | 2020-05-05 19:55:28 +0100 |
commit | 9c8d26c97ff51ebc105e2bcf815c29ff79eea2a6 (patch) | |
tree | 6ca5eed23141771015a54cbaa3fe932f1b7140aa | |
parent | f27d13de08af9ae788b0d2f848e2202a399e4f43 (diff) | |
download | vyos-live-build-9c8d26c97ff51ebc105e2bcf815c29ff79eea2a6.tar.gz vyos-live-build-9c8d26c97ff51ebc105e2bcf815c29ff79eea2a6.zip |
packages: avoid unnecessary nesting
Gbp-Dch: Ignore
-rwxr-xr-x | functions/packages.sh | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/functions/packages.sh b/functions/packages.sh index 0044a46e4..75bbd8478 100755 --- a/functions/packages.sh +++ b/functions/packages.sh @@ -39,27 +39,28 @@ Check_package () # Note, reads from _LB_PACKAGES Install_package () { - if [ -n "${_LB_PACKAGES}" ] && [ "${LB_BUILD_WITH_CHROOT}" != "false" ] - then - # Record in file to survive failure such that recovery can take place. - local LIST_FILE - LIST_FILE="$(Installed_tmp_packages_file)" - local PACKAGE - for PACKAGE in ${_LB_PACKAGES}; do - echo "${PACKAGE}" >> "${LIST_FILE}" - done - - case "${LB_APT}" in - apt|apt-get) - Chroot chroot "apt-get install -o APT::Install-Recommends=false ${APT_OPTIONS} ${_LB_PACKAGES}" - ;; - - aptitude) - Chroot chroot "aptitude install --without-recommends ${APTITUDE_OPTIONS} ${_LB_PACKAGES}" - ;; - esac - unset _LB_PACKAGES # Can clear this now + if [ -z "${_LB_PACKAGES}" ] || [ "${LB_BUILD_WITH_CHROOT}" != "true" ]; then + return fi + + # Record in file to survive failure such that recovery can take place. + local LIST_FILE + LIST_FILE="$(Installed_tmp_packages_file)" + local PACKAGE + for PACKAGE in ${_LB_PACKAGES}; do + echo "${PACKAGE}" >> "${LIST_FILE}" + done + + case "${LB_APT}" in + apt|apt-get) + Chroot chroot "apt-get install -o APT::Install-Recommends=false ${APT_OPTIONS} ${_LB_PACKAGES}" + ;; + + aptitude) + Chroot chroot "aptitude install --without-recommends ${APTITUDE_OPTIONS} ${_LB_PACKAGES}" + ;; + esac + unset _LB_PACKAGES # Can clear this now } Remove_package () |