summaryrefslogtreecommitdiffstats
path: root/share/build-scripts/debconf
diff options
context:
space:
mode:
Diffstat (limited to 'share/build-scripts/debconf')
-rwxr-xr-xshare/build-scripts/debconf78
1 files changed, 52 insertions, 26 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"