diskimage-builder/elements/apt-sources/extra-data.d/99-override-default-apt-sources
Ben Nemec 16be6d7ce0 set -u and -o pipefail everywhere
As with the previous similar changes, this is intended to catch
problems as they happen instead of ignoring them and continuing on
to potentially fail later.  Setting this on all existing scripts
will allow us to enforce use via Jenkins.

Change-Id: Iad2d490c86dceab148ea9ab08f457c49a5d5352e
2014-05-06 15:51:07 -05:00

23 lines
684 B
Bash
Executable File

#!/bin/bash
# Override the default /etc/apt/sources.list with $DIB_APT_SOURCES
set -eu
set -o pipefail
# exit directly if DIB_APT_SOURCES is not defined properly
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
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"
exit 1
fi
DIB_APT_SOURCES=`readlink -f $DIB_APT_SOURCES`
# copy the sources.list to cloudimg
pushd $TMP_MOUNT_PATH/etc/apt/
sudo cp -f $DIB_APT_SOURCES sources.list
popd