diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2022-02-28 12:16:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2022-02-28 12:16:12 +0000 |
commit | 8d468574710ca18e8af8ca3a343dc0cb608dedaa (patch) | |
tree | 44a21413b725b62f785fd0492532ada3cc302544 | |
parent | DEBIAN (diff) | |
download | compute-tools-tmp-ip-from-dns-3.tar.xz compute-tools-tmp-ip-from-dns-3.zip |
Updating.tmp-ip-from-dns-3
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-x | share/build-scripts/debconf | 78 | ||||
-rwxr-xr-x | share/build-scripts/debconf.d/0003-debconf | 2 |
2 files changed, 53 insertions, 27 deletions
diff --git a/share/build-scripts/debconf b/share/build-scripts/debconf index 688e77d..f2710e5 100755 --- a/share/build-scripts/debconf +++ b/share/build-scripts/debconf @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -x # Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> # @@ -596,32 +596,58 @@ EOF if [ -n "${DIG}" ] then - 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_DNS="${IPV6_ADDRESS1_DNS:-${NAME}}" - IPV6_ADDRESS1="$(${DIG} AAAA +short ${IPV6_ADDRESS1_DNS} | tail -n1)" - # FIXME: address parts - - 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 + rm -f "${DIRECTORY}/preseed.cfg.tmp" + cp "${FILE}" "${DIRECTORY}/preseed.cfg.tmp" - 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" + for NUMBER in $(seq 1 ${NETWORK_NUMBER}) + do + eval IPV4_ADDRESS_DNS="$`echo IPV4_ADDRESS${NUMBER}_DNS`" + eval IPV4_ADDRESS="$`echo IPV4_ADDRESS${NUMBER}`" + + if [ -z "${IPV4_ADDRESS}" ] && [ -n "${IPV4_ADDRESS_DNS}" ] + then + IPV4_ADDRESS="$(${DIG} A +short ${IPV4_ADDRESS_DNS} | tail -n1)" + export eval IPV4_ADDRESS${NUMBER}="${IPV4_ADDRESS}" + fi + + eval IPV4_ADDRESS_PART1="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f1)" + eval IPV4_ADDRESS${NUMBER}_PART1="${IPV4_ADDRESS_PART1}" + export eval IPV4_ADDRESS${NUMBER}_PART1 + + eval IPV4_ADDRESS_PART2="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f2)" + eval IPV4_ADDRESS${NUMBER}_PART2="${IPV4_ADDRESS_PART2}" + export eval IPV4_ADDRESS${NUMBER}_PART2 + + eval IPV4_ADDRESS_PART3="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f3)" + eval IPV4_ADDRESS${NUMBER}_PART3="${IPV4_ADDRESS_PART3}" + export eval IPV4_ADDRESS${NUMBER}_PART3 + + eval IPV4_ADDRESS_PART4="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f4)" + eval IPV4_ADDRESS${NUMBER}_PART4="${IPV4_ADDRESS_PART4}" + export eval IPV4_ADDRESS${NUMBER}_PART4 + + #IPV6_ADDRESS1_DNS="${IPV6_ADDRESS1_DNS:-${NAME}}" + #IPV6_ADDRESS1="$(${DIG} AAAA +short ${IPV6_ADDRESS1_DNS} | tail -n1)" + # FIXME: address parts + #export IPV6_ADDRESS1_DNS IPV6_ADDRESS1 + + # FIXME + sed -i -e "s|@FILE@|${FILE}|g" \ + -e "s|@NAME@|${NAME}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_DNS@|${IPV4_ADDRESS_DNS}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}@|${IPV4_ADDRESS}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART1@|${IPV4_ADDRESS_PART1}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART2@|${IPV4_ADDRESS_PART2}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART3@|${IPV4_ADDRESS_PART3}|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART4@|${IPV4_ADDRESS_PART4}|g" \ + -e "s|@IPV6_ADDRESS${NUMBER}_DNS@|${IPV6_ADDRESS_DNS}|g" \ + -e "s|@IPV6_ADDRESS${NUMBER}@|${IPV6_ADDRESS}|g" \ + "${DIRECTORY}/preseed.cfg.tmp" + done + + rm -f "${DIRECTORY}/preseed.cfg" + mv "${DIRECTORY}/preseed.cfg.tmp" "${DIRECTORY}/preseed.cfg" + fi done Chroot "${DIRECTORY}" "debconf-set-selections preseed.cfg" diff --git a/share/build-scripts/debconf.d/0003-debconf b/share/build-scripts/debconf.d/0003-debconf index 4b6a57f..d5a3783 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> # |