From 82720d195c6b243f8f3a610c555392d20745889b Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Fri, 23 Dec 2022 10:27:17 +0100 Subject: debvm-create: conditionalize network workarounds on $DEBVER --- debvm-create | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/debvm-create b/debvm-create index 8ea33fb..f9bd458 100755 --- a/debvm-create +++ b/debvm-create @@ -145,25 +145,17 @@ if test -n "$SSHKEY"; then fi # add a DNS resolver -case "$SUITE" in - jessie) - set -- '--customize-hook=chroot "$1" systemctl enable systemd-resolved.service' "$@" - set -- '--customize-hook=ln -fs ../run/systemd/resolve/resolv.conf "$1/etc/resolv.conf"' "$@" - ;; - stretch) - set -- '--customize-hook=chroot "$1" systemctl enable systemd-resolved.service' "$@" - set -- '--customize-hook=ln -fs ../run/systemd/resolve/resolv.conf "$1/etc/resolv.conf"' "$@" - INCLUDE_PACKAGES="$INCLUDE_PACKAGES,libnss-resolve" - ;; - buster|bullseye|stable) - set -- '--customize-hook=chroot "$1" systemctl enable systemd-resolved.service' "$@" - set -- '--customize-hook=ln -fs ../run/systemd/resolve/stub-resolv.conf "$1/etc/resolv.conf"' "$@" - INCLUDE_PACKAGES="$INCLUDE_PACKAGES,libnss-resolve" - ;; - *) - INCLUDE_PACKAGES="$INCLUDE_PACKAGES,libnss-resolve" - ;; -esac +if test "$DEBVER" -ge 9; then + INCLUDE_PACKAGES="$INCLUDE_PACKAGES,libnss-resolve" +fi +if test "$DEBVER" -le 11; then + set -- '--customize-hook=chroot "$1" systemctl enable systemd-resolved.service' "$@" +fi +if test "$DEBVER" -le 9; then + set -- '--customize-hook=ln -fs ../run/systemd/resolve/resolv.conf "$1/etc/resolv.conf"' "$@" +elif test "$DEBVER" -le 11; then + set -- '--customize-hook=ln -fs ../run/systemd/resolve/stub-resolv.conf "$1/etc/resolv.conf"' "$@" +fi # construct mmdebstrap options as $@: set -- \ @@ -187,15 +179,13 @@ set -- '--customize-hook=chroot "$1" passwd --delete root' "$@" # dhcp on all network interfaces SYSD_NET_MATCH='Name=en*\n' -test "$SUITE" = jessie && SYSD_NET_MATCH="${SYSD_NET_MATCH}Name=eth*\n" +test "$DEBVER" -le 8 && SYSD_NET_MATCH="${SYSD_NET_MATCH}Name=eth*\\n" SYSD_NET_NET='DHCP=yes\n' # This anchor is included by default since bullseye. Fails DNSSEC validation when missing. -case "$SUITE" in jessie|stretch|buster) - SYSD_NET_NET="${SYSD_NET_NET}DNSSECNegativeTrustAnchors=home.arpa\n" -;; esac +test "$DEBVER" -le 11 && SYSD_NET_NET="${SYSD_NET_NET}DNSSECNegativeTrustAnchors=home.arpa\\n" set -- \ '--customize-hook=chroot "$1" systemctl enable systemd-networkd.service' \ - "--customize-hook=printf \"[Match]\\n${SYSD_NET_MATCH}\\n[Network]\\n$SYSD_NET_NET"'\n[DHCP]\nUseDomains=yes\n" > "$1/etc/systemd/network/20-wired.network"' \ + "--customize-hook=printf \"[Match]\\n$SYSD_NET_MATCH\\n[Network]\\n$SYSD_NET_NET"'\n[DHCP]\nUseDomains=yes\n" > "$1/etc/systemd/network/20-wired.network"' \ "$@" # add ssh key for root -- cgit v1.2.3