From 852cec378959d93d11b09caa4a9b2048f51fbfbe Mon Sep 17 00:00:00 2001 From: Jon-Paul Sullivan Date: Thu, 20 Feb 2014 10:59:15 +0000 Subject: [PATCH] Enable custom apt.conf in apt-conf element Allow DIB_APT_CONF to be set to the apt.conf file to be inserted into the built images. Change-Id: I5d148ae7286a93e81b3e984c94ba4f089d3a3280 --- elements/apt-conf/README.md | 18 ++++++++++++++++++ .../extra-data.d/99-override-default-apt-conf | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 elements/apt-conf/README.md create mode 100755 elements/apt-conf/extra-data.d/99-override-default-apt-conf diff --git a/elements/apt-conf/README.md b/elements/apt-conf/README.md new file mode 100644 index 00000000..2daf2714 --- /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 00000000..c0883c87 --- /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