From 06ccb7484fbaa6f92c85820434c923683ae5364b Mon Sep 17 00:00:00 2001 From: Stuart McLaren Date: Fri, 28 Mar 2014 13:39:44 +0000 Subject: [PATCH] apt-conf: uninitialised variables fix In the bash script "99-override-default-apt-conf" 'set -u' is being used to check for uninitialised variables. This resulted in generic 'unbound variable' messages rather than the intended error messages. Tweaked the check for DIB_APT_CONF to work if the variable is unbound; so that we get the intended error message rather than the `unbound variable` message. Change-Id: Ib8e287060f32312ab80dd7f44e2792ecca48edbb --- elements/apt-conf/extra-data.d/99-override-default-apt-conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/apt-conf/extra-data.d/99-override-default-apt-conf b/elements/apt-conf/extra-data.d/99-override-default-apt-conf index c0883c87..662b618b 100755 --- a/elements/apt-conf/extra-data.d/99-override-default-apt-conf +++ b/elements/apt-conf/extra-data.d/99-override-default-apt-conf @@ -1,10 +1,10 @@ #!/bin/bash # Override the default /etc/apt/apt.conf with $DIB_APT_CONF -set -eu +set -ue # exit directly if DIB_APT_CONF is not defined properly -if [ -z "$DIB_APT_CONF" ] ; then +if [ -z "${DIB_APT_CONF:-}" ] ; then echo "DIB_APT_CONF is not set - no apt.conf will be copied in" exit 0 elif [ ! -f "$DIB_APT_CONF" ] ; then