diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-11-01 08:11:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-11-01 08:12:04 +0000 |
commit | 81e795fae63e2290a700fbc2901e6b05cdfadda4 (patch) | |
tree | e49b055d8d6b6226dcf2e3dd008cfd0e010dd4ad /share/scripts/debconf | |
parent | Supporting using IP address from DNS lookup of the container name in preseed ... (diff) | |
download | compute-tools-81e795fae63e2290a700fbc2901e6b05cdfadda4.tar.xz compute-tools-81e795fae63e2290a700fbc2901e6b05cdfadda4.zip |
Supporting using IP address parts of the container name in preseed files for container debconf create script.
This is usefull to automatically construct IP gateway addresses or
veth interface names in a diff-friendly way.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-x | share/scripts/debconf | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index 93cbda9..3bc3b43 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -629,10 +629,18 @@ EOF if [ -n "${DIG}" ] then IPV4_ADDRESS1="$(${DIG} +short ${NAME} | 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)" fi sed -e "s|@NAME@|${NAME}|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" \ "${FILE}" >> "${DIRECTORY}/preseed.cfg" done |