summaryrefslogtreecommitdiff
path: root/scripts/files/elements/apt-conf-dir/extra-data.d/99-use-host-apt-confd
blob: e286d684e126bcc64bf2abe5701077c6a2ac2062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Override the default /etc/apt/apt.conf.d directory with $DIB_APT_CONF_DIR

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

# exit directly if DIB_APT_CONF_DIR is not defined properly
if [ -z "${DIB_APT_CONF_DIR:-}" ] ; then
    echo "DIB_APT_CONF_DIR is not set - no apt.conf.d will be copied in"
    exit 0
elif [ ! -d "$DIB_APT_CONF_DIR" ] ; then
    echo "$DIB_APT_CONF_DIR is not a valid apt.conf.d directory."
    echo "You should assign a proper apt.conf.d directory in DIB_APT_CONF_DIR"
    exit 1
fi

# copy the apt.conf to cloudimg
sudo cp -L -f -R $DIB_APT_CONF_DIR $TMP_MOUNT_PATH/etc/apt