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
This commit is contained in:
Martin André 2015-02-03 16:17:00 +09:00
parent 1b2017914c
commit 2cd6f3fc3b
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ set -eu
set -o pipefail set -o pipefail
# exit directly if DIB_DPKG_MANIFEST is not defined properly # 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" echo "DIB_DPKG_MANIFEST must be set to the location of a manifest file you wish to use"
exit 0 exit 0
elif [ ! -f "$DIB_DPKG_MANIFEST" -o ! -s "$DIB_DPKG_MANIFEST" ]; then elif [ ! -f "$DIB_DPKG_MANIFEST" -o ! -s "$DIB_DPKG_MANIFEST" ]; then

View File

@ -5,9 +5,9 @@ set -eu
set -o pipefail set -o pipefail
# exit directly if DIB_APT_SOURCES is not defined properly # 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" 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 elif [ ! -f "$DIB_APT_SOURCES" -o ! -s "$DIB_APT_SOURCES" ] ; then
echo "$DIB_APT_SOURCES is not a valid sources.list file." echo "$DIB_APT_SOURCES is not a valid sources.list file."
echo "You should assign proper sources.list file in DIB_APT_SOURCES" echo "You should assign proper sources.list file in DIB_APT_SOURCES"