summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf.d/0002-preseed-debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-10-27 07:46:44 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-11-01 03:35:15 +0000
commitaa1af8ec858f251b0ed3c6dfcc503acf78d2261c (patch)
treeb0df89b8fcf221b4ab8382133696df26b64d8083 /share/scripts/debconf.d/0002-preseed-debconf
parentAvoiding to display .cfg extension for preseed files in container debconf cre... (diff)
downloadcompute-tools-aa1af8ec858f251b0ed3c6dfcc503acf78d2261c.tar.xz
compute-tools-aa1af8ec858f251b0ed3c6dfcc503acf78d2261c.zip
Supporting using IP address from DNS lookup of the container name in preseed files for container debconf create script.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/scripts/debconf.d/0002-preseed-debconf')
-rwxr-xr-xshare/scripts/debconf.d/0002-preseed-debconf17
1 files changed, 16 insertions, 1 deletions
diff --git a/share/scripts/debconf.d/0002-preseed-debconf b/share/scripts/debconf.d/0002-preseed-debconf
index 48fa6a1..36cf948 100755
--- a/share/scripts/debconf.d/0002-preseed-debconf
+++ b/share/scripts/debconf.d/0002-preseed-debconf
@@ -72,7 +72,22 @@ done
for DEBCONF_PRESEED_FILE in ${DEBCONF_PRESEED_FILES}
do
- sed -e "s|@NAME@|${NAME}|g" "${DEBCONF_PRESEED_FILE}" > "${DIRECTORY}/preseed.cfg"
+ if [ -e /usr/bin/kdig ]
+ then
+ DIG="/usr/bin/kdig"
+ elif [ -e /usr/bin/dig ]
+ then
+ DIG="/usr/bin/dig"
+ fi
+
+ if [ -n "${DIG}" ]
+ then
+ IPV4_ADDRESS="$(${DIG} +short ${NAME} | tail -n1)"
+ fi
+
+ sed -e "s|@NAME@|${NAME}|g" \
+ -e "s|@IPV4_ADDRESS@|${IPV4_ADDRESS}|g" \
+ "${DEBCONF_PRESEED_FILE}" > "${DIRECTORY}/preseed.cfg"
# Apply user specified preseed files
debconf-set-selections "${DIRECTORY}/preseed.cfg"