summaryrefslogtreecommitdiffstats
path: root/share/build-scripts/debconf.d/0003-debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-02-28 12:15:01 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-02-28 12:15:01 +0000
commit9e5408c5a566619db24b2245868a3a414f9d4dbd (patch)
treebf838dfb462012df46136b346081012952ec5a65 /share/build-scripts/debconf.d/0003-debconf
parentDEBIAN (diff)
downloadcompute-tools-tmp-ip-from-dns-2.tar.xz
compute-tools-tmp-ip-from-dns-2.zip
Diffstat (limited to 'share/build-scripts/debconf.d/0003-debconf')
-rwxr-xr-xshare/build-scripts/debconf.d/0003-debconf19
1 files changed, 18 insertions, 1 deletions
diff --git a/share/build-scripts/debconf.d/0003-debconf b/share/build-scripts/debconf.d/0003-debconf
index 4b6a57f..f8e9cc1 100755
--- a/share/build-scripts/debconf.d/0003-debconf
+++ b/share/build-scripts/debconf.d/0003-debconf
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -x
# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
@@ -24,6 +24,14 @@ export DEBCONF_NOWARNINGS
. /usr/share/debconf/confmodule
+if [ -e /usr/bin/kdig ]
+then
+ DIG="/usr/bin/kdig"
+elif [ -e /usr/bin/dig ]
+then
+ DIG="/usr/bin/dig"
+fi
+
Mode ()
{
db_get container/mode
@@ -1076,6 +1084,11 @@ Network ()
echo "NETWORK${NUMBER}_IPV4_ADDRESS_DNS=\"${ADDRESS_DNS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
eval ADDRESS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS`"
+ echo DEBUG DEBUG
+ if [ -n "${ADDRESS_DNS}" ] && [ -z "${ADDRESS}" ] && [ -n "${DIG}" ]
+ then
+ ADDRESS="$(${DIG} A +short ${ADDRESS_DNS} | tail -n1)"
+ fi
echo "NETWORK${NUMBER}_IPV4_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
eval GATEWAY="$`echo NETWORK${NUMBER}_IPV4_GATEWAY`"
@@ -1100,6 +1113,10 @@ Network ()
echo "NETWORK${NUMBER}_IPV6_ADDRESS_DNS=\"${ADDRESS_DNS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
eval ADDRESS="$`echo NETWORK${NUMBER}_IPV6_ADDRESS`"
+ if [ -n "${ADDRESS_DNS}" ] && [ -z "${ADDRESS}" ]
+ then
+ ADDRESS="$(${DIG} AAAA +short ${ADDRESS_DNS} | tail -n1)"
+ fi
echo "NETWORK${NUMBER}_IPV6_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
eval GATEWAY="$`echo NETWORK${NUMBER}_IPV6_GATEWAY`"