diff options
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-x | share/scripts/debconf | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index 619d84c..8e332c5 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -613,35 +613,45 @@ EOF Upgrade_system "${DIRECTORY}" + if [ -e /usr/bin/kdig ] + then + DIG="/usr/bin/kdig" + elif [ -e /usr/bin/dig ] + then + DIG="/usr/bin/dig" + fi + # Preseed system if [ -n "${PRESEED_FILE}" ] then for FILE in ${PRESEED_FILE} do - if [ -e /usr/bin/kdig ] - then - DIG="/usr/bin/kdig" - elif [ -e /usr/bin/dig ] - then - DIG="/usr/bin/dig" - fi + cat "${FILE}" >> "${DIRECTORY}/preseed.cfg" + done + + sed -i -e "s|@NAME@|${NAME}|g" "${DIRECTORY}/preseed.cfg" + NUMBER="1" + + while grep -qs "@IPV4_ADDRESS${NUMBER}.*@" "${FILE}" + do if [ -n "${DIG}" ] then - IPV4_ADDRESS="$(${DIG} +short ${NAME} | tail -n1)" - IPV4_ADDRESS_PART1="$(echo ${IPV4_ADDRESS} | cut -d. -f1)" - IPV4_ADDRESS_PART2="$(echo ${IPV4_ADDRESS} | cut -d. -f2)" - IPV4_ADDRESS_PART3="$(echo ${IPV4_ADDRESS} | cut -d. -f3)" - IPV4_ADDRESS_PART4="$(echo ${IPV4_ADDRESS} | cut -d. -f4)" + eval IPV4_ADDRESS${NUMBER}="$(${DIG} +short ${NAME} | tail -n1)" + eval IPV4_ADDRESS${NUMBER}_PART1="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f1)" + eval IPV4_ADDRESS${NUMBER}_PART2="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f2)" + eval IPV4_ADDRESS${NUMBER}_PART3="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f3)" + eval IPV4_ADDRESS${NUMBER}_PART4="$(echo $`echo IPV4_ADDRESS${NUMBER}` | cut -d. -f4)" fi - sed -e "s|@NAME@|${NAME}|g" \ - -e "s|@IPV4_ADDRESS@|${IPV4_ADDRESS}|g" \ - -e "s|@IPV4_ADDRESS_PART1@|${IPV4_ADDRESS_PART1}|g" \ - -e "s|@IPV4_ADDRESS_PART2@|${IPV4_ADDRESS_PART2}|g" \ - -e "s|@IPV4_ADDRESS_PART3@|${IPV4_ADDRESS_PART3}|g" \ - -e "s|@IPV4_ADDRESS_PART4@|${IPV4_ADDRESS_PART4}|g" \ - "${FILE}" >> "${DIRECTORY}/preseed.cfg" + sed -i -e "s|@IPV4_ADDRESS${NUMBER}@|$`echo IPV4_ADDRESS${NUMBER}`|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART1@|$`echo IPV4_ADDRESS${NUMBER}_PART1`|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART2@|$`echo IPV4_ADDRESS${NUMBER}_PART2`|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART3@|$`echo IPV4_ADDRESS${NUMBER}_PART3`|g" \ + -e "s|@IPV4_ADDRESS${NUMBER}_PART4@|$`echo IPV4_ADDRESS${NUMBER}_PART4`|g" \ + "${DIRECTORY}/preseed.cfg" + + NUMBER="$((${NUMBER} + 1))" done Chroot "${DIRECTORY}" "debconf-set-selections preseed.cfg" |