From 3675664a50757ef20a7a139dc63293e6fd52bfe9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 24 Jul 2017 11:56:44 +0200 Subject: Fixing issues from network0 -> network1 transition in debconf container create script. Signed-off-by: Daniel Baumann --- share/scripts/debconf | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'share/scripts/debconf') diff --git a/share/scripts/debconf b/share/scripts/debconf index 6190c31..0b80353 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -762,7 +762,7 @@ Configure_network () fi # Create /etc/hosts - case "${NETWORK0_IPV4_METHOD}" in + case "${NETWORK1_IPV4_METHOD}" in none|dhcp) cat > "${DIRECTORY}/etc/hosts.tmp" << EOF @@ -782,7 +782,7 @@ EOF cat > "${DIRECTORY}/etc/hosts.tmp" << EOF 127.0.0.1 localhost -${NETWORK0_IPV4_ADDRESS} ${NAME} +${NETWORK1_IPV4_ADDRESS} ${NAME} # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback @@ -929,36 +929,39 @@ Commands () # maximum of 15 characters, prefix is 'veth-' HOSTNAME_SHORT="$(echo ${NAME} | cut -c-8)" - HOST_INTERFACE_NAME="$(echo ${NETWORK0_VETH:-veth-${HOSTNAME_SHORT}-0})" + HOST_INTERFACE_NAME="$(echo ${NETWORK1_VETH:-veth-${HOSTNAME_SHORT}-0})" sed -i -e "s|^cnt.auto=.*|cnt.auto=${CNT_AUTO}|g" \ -e "s|^cnt.container-server=.*|cnt.container-server=${CNT_CONTAINER_SERVER}|g" \ - -e "s|^cnt.network-bridge=.*|cnt.network-bridge=${HOST_INTERFACE_NAME}:${NETWORK0_BRIDGE:-bridge0}|g" \ + -e "s|^cnt.network-bridge=.*|cnt.network-bridge=${HOST_INTERFACE_NAME}:${NETWORK1_BRIDGE:-bridge0}|g" \ -e "s|^cnt.overlay=.*|cnt.overlay=${CNT_OVERLAY}|g" \ -e "s|^bind=.*|bind=${BIND}|g" \ -e "s|^bind-ro=.*|bind-ro=${BIND_RO}|g" \ -e "s|^network-veth-extra=.*|network-veth-extra=${HOST_INTERFACE_NAME}:eno1|g" \ "${CONFIG}/${NAME}.conf" - for NUMBER in $(seq 1 ${NETWORK_NUMBER}) - do - eval IPV4_METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`" + if [ "${NETWORK_NUMBER}" -ge 2 ] + then + for NUMBER in $(seq 2 ${NETWORK_NUMBER}) + do + eval IPV4_METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`" - if [ -z "${IPV4_METHOD}" ] - then - continue - fi + if [ -z "${IPV4_METHOD}" ] + then + continue + fi - eval HOST_INTERFACE_NAME="$`echo NETWORK${NUMBER}_VETH`" + eval HOST_INTERFACE_NAME="$`echo NETWORK${NUMBER}_VETH`" - HOST_INTERFACE_NAME="$(echo ${HOST_INTERFACE_NAME:-veth-${HOSTNAME_SHORT}-${NUMBER}})" - CONTAINER_INTERFACE_NAME="eno${NUMBER}" + HOST_INTERFACE_NAME="$(echo ${HOST_INTERFACE_NAME:-veth-${HOSTNAME_SHORT}-${NUMBER}})" + CONTAINER_INTERFACE_NAME="eno${NUMBER}" - sed -i -e "/^register=.*/ a network-veth-extra=${HOST_INTERFACE_NAME}:${CONTAINER_INTERFACE_NAME}" "${CONFIG}/${NAME}.conf" + sed -i -e "/^register=.*/ a network-veth-extra=${HOST_INTERFACE_NAME}:${CONTAINER_INTERFACE_NAME}" "${CONFIG}/${NAME}.conf" - eval BRIDGE="$`echo NETWORK${NUMBER}_BRIDGE`" - sed -i -e "/^register=.*/ a cnt.network-bridge=${HOST_INTERFACE_NAME}:${BRIDGE:-bridge${NUMBER}}" "${CONFIG}/${NAME}.conf" - done + eval BRIDGE="$`echo NETWORK${NUMBER}_BRIDGE`" + sed -i -e "/^register=.*/ a cnt.network-bridge=${HOST_INTERFACE_NAME}:${BRIDGE:-bridge${NUMBER}}" "${CONFIG}/${NAME}.conf" + done + fi # Setting root password echo root:${ROOT_PASSWORD} | chroot "${DIRECTORY}" chpasswd -- cgit v1.2.3