diff --git a/elements/apt-conf/README.md b/elements/apt-conf/README.md new file mode 100644 index 000000000..2daf27145 --- /dev/null +++ b/elements/apt-conf/README.md @@ -0,0 +1,18 @@ +Override the default apt.conf +============================= + +For APT based systems, if you require specific options for apt operations, +you can define `DIB_APT_CONF` with your favorite apt.conf to override it, +before running devtest.sh. + +The new apt.conf will take effect at build time and run time. + +If you want to use this element with tripleo-incubator scripts, set `NODE_DIST` +/ `SEED_DIB_EXTRA_ARGS` / `UNDERCLOUD_DIB_EXTRA_ARGS` / +`OVERCLOUD_CONTROL_DIB_EXTRA_ARGS` / `OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS` to +make it take effect at the appropriate time. + +For instance, before running devtest.sh: + + export DIB_APT_CONF=/etc/apt/apt.conf + export NODE_DIST="ubuntu apt-conf" 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 new file mode 100755 index 000000000..c0883c874 --- /dev/null +++ b/elements/apt-conf/extra-data.d/99-override-default-apt-conf @@ -0,0 +1,17 @@ +#!/bin/bash +# Override the default /etc/apt/apt.conf with $DIB_APT_CONF + +set -eu + +# exit directly if DIB_APT_CONF is not defined properly +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 + echo "$DIB_APT_CONF is not a valid apt.conf file." + echo "You should assign a proper apt.conf file in DIB_APT_CONF" + exit 1 +fi + +# copy the apt.conf to cloudimg +sudo cp -L -f $DIB_APT_CONF $TMP_MOUNT_PATH/etc/apt/apt.conf