diff options
Diffstat (limited to '')
-rwxr-xr-x | share/scripts/debconf | 58 | ||||
-rwxr-xr-x | share/scripts/debconf.d/0003-debconf | 106 | ||||
-rw-r--r-- | share/scripts/debconf.d/0003-debconf.templates | 30 |
3 files changed, 107 insertions, 87 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index 38bf937..6190c31 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -19,6 +19,7 @@ set -e SCRIPT="${0}" +export SCRIPT CONFIG="/etc/container-tools/config" HOOKS="/etc/container-tools/hooks" @@ -809,7 +810,7 @@ Configure_systemd_networkd () chroot "${DIRECTORY}" systemctl enable systemd-networkd - for NUMBER in $(seq 0 ${NETWORK_NUMBER}) + for NUMBER in $(seq 1 ${NETWORK_NUMBER}) do eval IPV4_COMMENT="$`echo NETWORK${NUMBER}_IPV4_COMMENT`" eval IPV4_METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`" @@ -827,22 +828,22 @@ Configure_systemd_networkd () IPV4_SUFFIX="$(CIDR ${IPV4_NETMASK})" IPV4_CIDR="${IPV4_ADDRESS}/${IPV4_SUFFIX}" -cat > "${DIRECTORY}/etc/systemd/network/eth${NUMBER}.network" << EOF +cat > "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF [Match] -Name=eth${NUMBER} +Name=eno${NUMBER} [Network] EOF if [ -n "${IPV4_COMMENT}" ] then - echo "Description=${IPV4_COMMENT}" >> "${DIRECTORY}/etc/systemd/network/eth${NUMBER}.network" + echo "Description=${IPV4_COMMENT}" >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" fi case "${IPV4_METHOD}" in dhcp) -cat >> "${DIRECTORY}/etc/systemd/network/eth${NUMBER}.network" << EOF +cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF DHCP=ipv4 EOF @@ -850,7 +851,7 @@ EOF static) -cat >> "${DIRECTORY}/etc/systemd/network/eth${NUMBER}.network" << EOF +cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF DHCP=no Address=${IPV4_CIDR} EOF @@ -858,7 +859,7 @@ EOF if [ -n "${IPV4_GATEWAY}" ] then -cat >> "${DIRECTORY}/etc/systemd/network/eth${NUMBER}.network" << EOF +cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF Gateway=${IPV4_GATEWAY} EOF @@ -868,7 +869,7 @@ EOF if [ -n "${IPV4_POST_UP}" ] then -cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eth${NUMBER}.service" << EOF +cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eno${NUMBER}.service" << EOF [Unit] Description=container-tools IPV4_POST_UP After=network-online.target @@ -882,13 +883,13 @@ ExecStart=/bin/sh -c "${IPV4_POST_UP}" WantedBy=multi-user.target EOF - chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-up-eth${NUMBER}.service + chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-up-eno${NUMBER}.service fi if [ -n "${IPV4_POST_DOWN}" ] then -cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eth${NUMBER}.service" << EOF +cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eno${NUMBER}.service" << EOF [Unit] Description=container-tools IPV4_POST_DOWN After=network.target @@ -902,7 +903,7 @@ ExecStart=/bin/sh -c "${IPV4_POST_DOWN}" WantedBy=multi-user.target EOF - chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-down-eth${NUMBER}.service + chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-down-eno${NUMBER}.service fi NUMBER="$((${NUMBER} + 1))" @@ -932,11 +933,11 @@ Commands () 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:-br0}|g" \ + -e "s|^cnt.network-bridge=.*|cnt.network-bridge=${HOST_INTERFACE_NAME}:${NETWORK0_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}:eth0|g" \ + -e "s|^network-veth-extra=.*|network-veth-extra=${HOST_INTERFACE_NAME}:eno1|g" \ "${CONFIG}/${NAME}.conf" for NUMBER in $(seq 1 ${NETWORK_NUMBER}) @@ -951,12 +952,12 @@ Commands () eval HOST_INTERFACE_NAME="$`echo NETWORK${NUMBER}_VETH`" HOST_INTERFACE_NAME="$(echo ${HOST_INTERFACE_NAME:-veth-${HOSTNAME_SHORT}-${NUMBER}})" - CONTAINER_INTERFACE_NAME="eth${NUMBER}" + CONTAINER_INTERFACE_NAME="eno${NUMBER}" 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:-br${NUMBER}}" "${CONFIG}/${NAME}.conf" + sed -i -e "/^register=.*/ a cnt.network-bridge=${HOST_INTERFACE_NAME}:${BRIDGE:-bridge${NUMBER}}" "${CONFIG}/${NAME}.conf" done # Setting root password @@ -971,24 +972,10 @@ Commands () umask 0022 -# Get distributor from template filename -MODE="$(basename ${SCRIPT})" - -case "${MODE}" in - debconf) - MODE="debian" - ;; -esac - -export MODE - -CACHE="/var/cache/container-tools/${MODE}" -SYSTEM="${MACHINES}/${NAME}" +export NAME Debconf -export NAME - # Pre hooks for FILE in "${HOOKS}/pre-${SCRIPT}".* "${HOOKS}/${NAME}.pre-${SCRIPT}" do @@ -999,19 +986,22 @@ do done # Run debconf parts -for SCRIPT in /usr/share/container-tools/scripts/debconf.d/* +for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/debconf.d/* do - if [ -x "${SCRIPT}" ] + if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${SCRIPT}" - "${SCRIPT}" + # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + "${DEBCONF_SCRIPT}" fi done # Read-in configuration from debconf . "${DEBCONF_TMPDIR}/debconf.default" +CACHE="/var/cache/container-tools/${MODE}" +SYSTEM="${MACHINES}/${NAME}" + ## Generic parts if [ ! -e "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ] then diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf index 8e78b3e..2592cf6 100755 --- a/share/scripts/debconf.d/0003-debconf +++ b/share/scripts/debconf.d/0003-debconf @@ -23,6 +23,26 @@ export DEBCONF_NOWARNINGS . /usr/share/debconf/confmodule +Mode () +{ + db_get cnt-debconf/mode + MODE="${RET}" # select + + if [ -z "${MODE}" ] + then + MODE="$(basename ${SCRIPT})" + + case "${MODE}" in + debconf) + MODE="debian" + ;; + esac + fi + + echo "MODE=\"${MODE}\"" >> "${DEBCONF_TMPDIR}/debconf.default" + export MODE +} + Distribution () { db_get cnt-debconf/distribution @@ -596,7 +616,7 @@ Packages () Local_archives () { - NUMBER="0" + NUMBER="1" while db_get cnt-debconf/archive${NUMBER}/repository && [ "${RET}" ] do @@ -674,10 +694,10 @@ Network_defaults () # * add support for bridges (make interface configuration more generic?) HOSTNAME_SHORT="$(echo veth-$(echo ${NAME} | cut -c-8)-0)" - VETH_NAME="$(echo ${HOSTNAME_SHORT:-veth0})" + VETH_NAME="${HOSTNAME_SHORT}" NETWORK0_VETH="${NETWORK0_VETH:-$VETH_NAME}" - NETWORK0_BRIDGE="${NETWORK0_BRIDGE:-br0}" + NETWORK0_BRIDGE="${NETWORK0_BRIDGE:-bridge0}" NETWORK0_IPV4_METHOD="${NETWORK0_IPV4_METHOD:-dhcp}" NETWORK0_IPV4_ADDRESS="${NETWORK0_IPV4_ADDRESS:-192.168.1.2}" NETWORK0_IPV4_NETMASK="${NETWORK0_IPV4_NETMASK:-255.255.255.0}" @@ -696,31 +716,31 @@ Network_defaults () Network () { - db_get cnt-debconf/network0/bridge + db_get cnt-debconf/network1/bridge NETWORK0_BRIDGE="${RET}" # string (w/o empty) - db_get cnt-debconf/network0/veth + db_get cnt-debconf/network1/veth NETWORK0_VETH="${RET}" # string (w/o empty) - db_get cnt-debconf/network0/ipv4-method + db_get cnt-debconf/network1/ipv4-method NETWORK0_IPV4_METHOD="${RET}" # select - db_get cnt-debconf/network0/ipv4-comment + db_get cnt-debconf/network1/ipv4-comment NETWORK0_IPV4_COMMENT="${RET}" # string (w/ empty) - db_get cnt-debconf/network0/ipv4-address + db_get cnt-debconf/network1/ipv4-address NETWORK0_IPV4_ADDRESS="${RET}" # string (w/o empty) - db_get cnt-debconf/network0/ipv4-gateway + db_get cnt-debconf/network1/ipv4-gateway NETWORK0_IPV4_GATEWAY="${RET}" # string (w/ empty) - db_get cnt-debconf/network0/ipv4-netmask + db_get cnt-debconf/network1/ipv4-netmask NETWORK0_IPV4_NETMASK="${RET}" # string (w/o empty) - db_get cnt-debconf/network0/ipv4-post-up + db_get cnt-debconf/network1/ipv4-post-up NETWORK0_IPV4_POST_UP="${RET}" # string (w/ empty) - db_get cnt-debconf/network0/ipv4-post-down + db_get cnt-debconf/network1/ipv4-post-down NETWORK0_IPV4_POST_DOWN="${RET}" # string (w/ empty) db_get cnt-debconf/nameserver/server @@ -737,32 +757,32 @@ Network () Network_defaults - db_set cnt-debconf/network0/bridge "${NETWORK0_BRIDGE}" - db_fset cnt-debconf/network0/bridge seen false + db_set cnt-debconf/network1/bridge "${NETWORK0_BRIDGE}" + db_fset cnt-debconf/network1/bridge seen false - db_set cnt-debconf/network0/veth "${NETWORK0_VETH}" - db_fset cnt-debconf/network0/veth seen false + db_set cnt-debconf/network1/veth "${NETWORK0_VETH}" + db_fset cnt-debconf/network1/veth seen false - db_set cnt-debconf/network0/ipv4-method "${NETWORK0_IPV4_METHOD}" - db_fset cnt-debconf/network0/ipv4-method seen false + db_set cnt-debconf/network1/ipv4-method "${NETWORK0_IPV4_METHOD}" + db_fset cnt-debconf/network1/ipv4-method seen false - db_set cnt-debconf/network0/ipv4-comment "${NETWORK0_IPV4_COMMENT}" - db_fset cnt-debconf/network0/ipv4-comment seen false + db_set cnt-debconf/network1/ipv4-comment "${NETWORK0_IPV4_COMMENT}" + db_fset cnt-debconf/network1/ipv4-comment seen false - db_set cnt-debconf/network0/ipv4-address "${NETWORK0_IPV4_ADDRESS}" - db_fset cnt-debconf/network0/ipv4-address seen false + db_set cnt-debconf/network1/ipv4-address "${NETWORK0_IPV4_ADDRESS}" + db_fset cnt-debconf/network1/ipv4-address seen false - db_set cnt-debconf/network0/ipv4-gateway "${NETWORK0_IPV4_GATEWAY}" - db_fset cnt-debconf/network0/ipv4-gateway seen false + db_set cnt-debconf/network1/ipv4-gateway "${NETWORK0_IPV4_GATEWAY}" + db_fset cnt-debconf/network1/ipv4-gateway seen false - db_set cnt-debconf/network0/ipv4-netmask "${NETWORK0_IPV4_NETMASK}" - db_fset cnt-debconf/network0/ipv4-netmask seen false + db_set cnt-debconf/network1/ipv4-netmask "${NETWORK0_IPV4_NETMASK}" + db_fset cnt-debconf/network1/ipv4-netmask seen false - db_set cnt-debconf/network0/ipv4-post-up "${NETWORK0_IPV4_POST_UP}" - db_fset cnt-debconf/network0/ipv4-post-up seen false + db_set cnt-debconf/network1/ipv4-post-up "${NETWORK0_IPV4_POST_UP}" + db_fset cnt-debconf/network1/ipv4-post-up seen false - db_set cnt-debconf/network0/ipv4-post-down "${NETWORK0_IPV4_POST_DOWN}" - db_fset cnt-debconf/network0/ipv4-post-down seen false + db_set cnt-debconf/network1/ipv4-post-down "${NETWORK0_IPV4_POST_DOWN}" + db_fset cnt-debconf/network1/ipv4-post-down seen false db_set cnt-debconf/nameserver/server "${NAMESERVER_SERVER}" db_fset cnt-debconf/nameserver/server seen false @@ -777,16 +797,16 @@ Network () db_fset cnt-debconf/nameserver/options seen false db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-method || true + db_input high cnt-debconf/network1/ipv4-method || true db_go - db_get cnt-debconf/network0/bridge + db_get cnt-debconf/network1/bridge NETWORK0_BRIDGE="${RET}" # select - db_get cnt-debconf/network0/veth + db_get cnt-debconf/network1/veth NETWORK0_VETH="${RET}" # select - db_get cnt-debconf/network0/ipv4-method + db_get cnt-debconf/network1/ipv4-method NETWORK0_IPV4_METHOD="${RET}" # select case "${NETWORK0_IPV4_METHOD}" in @@ -795,27 +815,27 @@ Network () static) db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-comment || true + db_input high cnt-debconf/network1/ipv4-comment || true db_go db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-address || true + db_input high cnt-debconf/network1/ipv4-address || true db_go db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-gateway || true + db_input high cnt-debconf/network1/ipv4-gateway || true db_go db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-netmask || true + db_input high cnt-debconf/network1/ipv4-netmask || true db_go db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-post-up || true + db_input high cnt-debconf/network1/ipv4-post-up || true db_go db_settitle cnt-debconf/title - db_input high cnt-debconf/network0/ipv4-post-down || true + db_input high cnt-debconf/network1/ipv4-post-down || true db_go db_settitle cnt-debconf/title @@ -824,7 +844,7 @@ Network () ;; esac - NUMBER="0" + NUMBER="1" while db_get cnt-debconf/network${NUMBER}/ipv4-method && [ "${RET}" ] do @@ -894,7 +914,7 @@ Network () echo "NETWORK_NUMBER=\"${NETWORK_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - for NUMBER in $(seq 0 ${NETWORK_NUMBER}) + for NUMBER in $(seq 1 ${NETWORK_NUMBER}) do eval BRIDGE="$`echo NETWORK${NUMBER}_BRIDGE`" echo "NETWORK${NUMBER}_BRIDGE=\"${BRIDGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default" @@ -1044,6 +1064,8 @@ Internal_options () echo "CNT_OVERLAY=\"${CNT_OVERLAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default" } +Mode + Distribution Parent_distribution diff --git a/share/scripts/debconf.d/0003-debconf.templates b/share/scripts/debconf.d/0003-debconf.templates index e46fa88..e3dbc24 100644 --- a/share/scripts/debconf.d/0003-debconf.templates +++ b/share/scripts/debconf.d/0003-debconf.templates @@ -2,6 +2,14 @@ Template: cnt-debconf/title Type: title Description: container-tools +Template: cnt-debconf/mode +Type: select +Default: +Choices-C: ${CHOICES_C} +Choices: ${CHOICES} +Description: Mode + Mode. + Template: cnt-debconf/distribution Type: select Default: @@ -92,19 +100,19 @@ Default: Description: Root password Root password. -Template: cnt-debconf/network0/bridge +Template: cnt-debconf/network1/bridge Type: string Default: Description: Bridge Bridge. -Template: cnt-debconf/network0/veth +Template: cnt-debconf/network1/veth Type: string Default: Description: Veth name Veth name. -Template: cnt-debconf/network0/ipv4-method +Template: cnt-debconf/network1/ipv4-method Type: select Choices: dhcp, static, none Default: @@ -114,7 +122,7 @@ Description: Ethernet Interface Method (IPv4)? This defaults to dhcp and will require that you run a dhcp-server in your network. -Template: cnt-debconf/network0/ipv4-comment +Template: cnt-debconf/network1/ipv4-comment Type: string Default: Description: Ethernet Interface Comment (IPv4)? @@ -122,7 +130,7 @@ Description: Ethernet Interface Comment (IPv4)? . This defaults to empty. -Template: cnt-debconf/network0/ipv4-address +Template: cnt-debconf/network1/ipv4-address Type: string Default: Description: Ethernet IP Address (IPv4)? @@ -130,7 +138,7 @@ Description: Ethernet IP Address (IPv4)? . This defaults to 192.168.1.2. -Template: cnt-debconf/network0/ipv4-gateway +Template: cnt-debconf/network1/ipv4-gateway Type: string Default: Description: Ethernet Gateway Address (IPv4)? @@ -138,7 +146,7 @@ Description: Ethernet Gateway Address (IPv4)? . This defaults to empty. -Template: cnt-debconf/network0/ipv4-netmask +Template: cnt-debconf/network1/ipv4-netmask Type: string Default: Description: Ethernet Network Mask (IPv4)? @@ -146,19 +154,19 @@ Description: Ethernet Network Mask (IPv4)? . This defaults to empty. -Template: cnt-debconf/network0/ipv4-post-up +Template: cnt-debconf/network1/ipv4-post-up Type: string Default: Description: Ethernet post-up Command (IPv4)? - What should be the post-up command for eth0? + What should be the post-up command for eno1? . This defaults to empty. -Template: cnt-debconf/network0/ipv4-post-down +Template: cnt-debconf/network1/ipv4-post-down Type: string Default: Description: Ethernet post-down Command (IPv4)? - What should be the post-down command for eth0? + What should be the post-down command for eno1? . This defaults to empty. |