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
This commit is contained in:
Stuart McLaren 2014-03-28 13:39:44 +00:00 committed by James Polley
parent b9189a204f
commit 06ccb7484f
1 changed files with 2 additions and 2 deletions

View File

@ -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