diff options
-rwxr-xr-x | share/scripts/debconf | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index 8fc7223..8ad2e51 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -810,8 +810,6 @@ EOF Configure_systemd_networkd () { - # FIXME: postup/postdown: multi-interface route - DIRECTORY="${1}" # Enable systemd-networkd @@ -829,8 +827,8 @@ Configure_systemd_networkd () eval IPV4_ADDRESS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS`" eval IPV4_GATEWAY="$`echo NETWORK${NUMBER}_IPV4_GATEWAY`" eval IPV4_NETMASK="$`echo NETWORK${NUMBER}_IPV4_NETMASK`" -# eval IPV4_POST_UP="$`echo NETWORK${NUMBER}_IPV4_POST_UP`" -# eval IPV4_POST_DOWN="$`echo NETWORK${NUMBER}_IPV4_POST_DOWN`" + eval IPV4_POST_UP="$`echo NETWORK${NUMBER}_IPV4_POST_UP`" + eval IPV4_POST_DOWN="$`echo NETWORK${NUMBER}_IPV4_POST_DOWN`" if [ -z "${IPV4_METHOD}" ] then @@ -878,6 +876,46 @@ EOF fi esac + if [ -n "${IPV4_POST_UP}" ] + then + +cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eth${NUMBER}.service" << EOF +[Unit] +Description=container-tools IPV4_POST_UP +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "${IPV4_POST_UP}" + +[Install] +WantedBy=multi-user.target +EOF + + chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-up-eth${NUMBER}.service + fi + + if [ -n "${IPV4_POST_DOWN}" ] + then + +cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eth${NUMBER}.service" << EOF +[Unit] +Description=container-tools IPV4_POST_DOWN +After=network.target +Wants=network.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "${IPV4_POST_DOWN}" + +[Install] +WantedBy=multi-user.target +EOF + + chroot "${DIRECTORY}" systemctl enable cnt-ipv4-post-down-eth${NUMBER}.service + fi + NUMBER="$((${NUMBER} + 1))" done } |