summaryrefslogtreecommitdiffstats
path: root/share/build-scripts/debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-02-27 11:35:36 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-02-27 11:35:36 +0000
commit221bf95949d4176e5276c7e8bfafa56c9104328b (patch)
tree5c882566cc9819bbccf07ec233c9185a390e4de9 /share/build-scripts/debconf
parentReleasing version 20211231. (diff)
downloadcompute-tools-221bf95949d4176e5276c7e8bfafa56c9104328b.tar.xz
compute-tools-221bf95949d4176e5276c7e8bfafa56c9104328b.zip
Adding support for deriving IP interface addresses from DNS.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/build-scripts/debconf')
-rwxr-xr-xshare/build-scripts/debconf22
1 files changed, 14 insertions, 8 deletions
diff --git a/share/build-scripts/debconf b/share/build-scripts/debconf
index 39856ae..688e77d 100755
--- a/share/build-scripts/debconf
+++ b/share/build-scripts/debconf
@@ -596,26 +596,30 @@ EOF
if [ -n "${DIG}" ]
then
- IPV4_ADDRESS1="$(${DIG} A +short ${NAME} | tail -n1)"
+ IPV4_ADDRESS1_DNS="${IPV4_ADDRESS1_DNS:-${NAME}}"
+ IPV4_ADDRESS1="$(${DIG} A +short ${IPV4_ADDRESS1_DNS} | tail -n1)"
IPV4_ADDRESS1_PART1="$(echo ${IPV4_ADDRESS1} | cut -d. -f1)"
IPV4_ADDRESS1_PART2="$(echo ${IPV4_ADDRESS1} | cut -d. -f2)"
IPV4_ADDRESS1_PART3="$(echo ${IPV4_ADDRESS1} | cut -d. -f3)"
IPV4_ADDRESS1_PART4="$(echo ${IPV4_ADDRESS1} | cut -d. -f4)"
- IPV6_ADDRESS1="$(${DIG} AAAA +short ${NAME} | tail -n1)"
+ IPV6_ADDRESS1_DNS="${IPV6_ADDRESS1_DNS:-${NAME}}"
+ IPV6_ADDRESS1="$(${DIG} AAAA +short ${IPV6_ADDRESS1_DNS} | tail -n1)"
# FIXME: address parts
- export IPV4_ADDRESS1 IPV4_ADDRESS1_PART1 IPV4_ADDRESS1_PART2 IPV4_ADDRESS1_PART3 IPV4_ADDRESS1_PART4
- export IPV6_ADDRESS1
+ export IPV4_ADDRESS1_DNS IPV4_ADDRESS1 IPV4_ADDRESS1_PART1 IPV4_ADDRESS1_PART2 IPV4_ADDRESS1_PART3 IPV4_ADDRESS1_PART4
+ export IPV6_ADDRESS1_DNS IPV6_ADDRESS1
fi
sed -e "s|@FILE@|${FILE}|g" \
-e "s|@NAME@|${NAME}|g" \
+ -e "s|@IPV4_ADDRESS1_DNS@|${IPV4_ADDRESS1_DNS}|g" \
-e "s|@IPV4_ADDRESS1@|${IPV4_ADDRESS1}|g" \
-e "s|@IPV4_ADDRESS1_PART1@|${IPV4_ADDRESS1_PART1}|g" \
-e "s|@IPV4_ADDRESS1_PART2@|${IPV4_ADDRESS1_PART2}|g" \
-e "s|@IPV4_ADDRESS1_PART3@|${IPV4_ADDRESS1_PART3}|g" \
-e "s|@IPV4_ADDRESS1_PART4@|${IPV4_ADDRESS1_PART4}|g" \
+ -e "s|@IPV6_ADDRESS1_DNS@|${IPV6_ADDRESS1_DNS}|g" \
-e "s|@IPV6_ADDRESS1@|${IPV6_ADDRESS1}|g" \
"${FILE}" >> "${DIRECTORY}/preseed.cfg"
done
@@ -757,7 +761,7 @@ Configure_network ()
then
cat >> "${DIRECTORY}/etc/hosts.tmp" << EOF
-${NETWORK1_IPV4_ADDRESS} ${NAME}
+${NETWORK1_IPV4_ADDRESS} ${NETWORK1_IPV4_ADDRESS_DNS}
EOF
fi
@@ -766,7 +770,7 @@ EOF
then
cat >> "${DIRECTORY}/etc/hosts.tmp" << EOF
-${NETWORK1_IPV6_ADDRESS} ${NAME}
+${NETWORK1_IPV6_ADDRESS} ${NETWORK1_IPV6_ADDRESS_DNS}
EOF
fi
@@ -781,8 +785,8 @@ EOF
# localhost only
cat > "${DIRECTORY}/etc/hosts.tmp" << EOF
-127.0.0.1 localhost ${NAME}
-::1 localhost ${NAME}
+127.0.0.1 localhost ${NETWORK1_IPV4_ADDRESS_DNS}
+::1 localhost ${NETWORK1_IPV6_ADDRESS_DNS}
EOF
else
@@ -818,6 +822,7 @@ Configure_systemd_networkd ()
do
eval IPV4_COMMENT="$`echo NETWORK${NUMBER}_IPV4_COMMENT`"
eval IPV4_METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`"
+ eval IPV4_ADDRESS_DNS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS_DNS`"
eval IPV4_ADDRESS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS`"
eval IPV4_GATEWAY="$`echo NETWORK${NUMBER}_IPV4_GATEWAY`"
eval IPV4_NETMASK="$`echo NETWORK${NUMBER}_IPV4_NETMASK`"
@@ -826,6 +831,7 @@ Configure_systemd_networkd ()
eval IPV6_COMMENT="$`echo NETWORK${NUMBER}_IPV6_COMMENT`"
eval IPV6_METHOD="$`echo NETWORK${NUMBER}_IPV6_METHOD`"
+ eval IPV6_ADDRESS_DNS="$`echo NETWORK${NUMBER}_IPV6_ADDRESS_DNS`"
eval IPV6_ADDRESS="$`echo NETWORK${NUMBER}_IPV6_ADDRESS`"
eval IPV6_GATEWAY="$`echo NETWORK${NUMBER}_IPV6_GATEWAY`"
eval IPV6_NETMASK="$`echo NETWORK${NUMBER}_IPV6_NETMASK`"