From 2cd6f3fc3b0337eb71d70b6cbc550b304139b84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Tue, 3 Feb 2015 16:17:00 +0900 Subject: [PATCH] Fix unbound variables in apt-{preferences,sources} Also make the apt-sources element exit with a non-error status code when the DIB_APT_SOURCES is not set. This allows including the apt-preferences and apt-sources elements even if DIB_DPKG_MANIFEST and DIB_APT_SOURCES are not exported. Change-Id: I8507dd9c69d1371eab38f720dcfdd89aa5345e8b --- elements/apt-preferences/extra-data.d/99-set-apt-package-pins | 2 +- .../apt-sources/extra-data.d/99-override-default-apt-sources | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/elements/apt-preferences/extra-data.d/99-set-apt-package-pins b/elements/apt-preferences/extra-data.d/99-set-apt-package-pins index 537d2457..8a62c2aa 100755 --- a/elements/apt-preferences/extra-data.d/99-set-apt-package-pins +++ b/elements/apt-preferences/extra-data.d/99-set-apt-package-pins @@ -18,7 +18,7 @@ set -eu set -o pipefail # exit directly if DIB_DPKG_MANIFEST is not defined properly -if [ -z "$DIB_DPKG_MANIFEST" ]; then +if [ -z "${DIB_DPKG_MANIFEST:-}" ]; then echo "DIB_DPKG_MANIFEST must be set to the location of a manifest file you wish to use" exit 0 elif [ ! -f "$DIB_DPKG_MANIFEST" -o ! -s "$DIB_DPKG_MANIFEST" ]; then diff --git a/elements/apt-sources/extra-data.d/99-override-default-apt-sources b/elements/apt-sources/extra-data.d/99-override-default-apt-sources index 0c8ae185..d0d928db 100755 --- a/elements/apt-sources/extra-data.d/99-override-default-apt-sources +++ b/elements/apt-sources/extra-data.d/99-override-default-apt-sources @@ -5,9 +5,9 @@ set -eu set -o pipefail # exit directly if DIB_APT_SOURCES is not defined properly -if [ -z "$DIB_APT_SOURCES" ] ; then +if [ -z "${DIB_APT_SOURCES:-}" ] ; then echo "DIB_APT_SOURCES must be set to the location of a sources.list file you wish to use" - exit 1 + exit 0 elif [ ! -f "$DIB_APT_SOURCES" -o ! -s "$DIB_APT_SOURCES" ] ; then echo "$DIB_APT_SOURCES is not a valid sources.list file." echo "You should assign proper sources.list file in DIB_APT_SOURCES"