summaryrefslogtreecommitdiff
path: root/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2022-12-23 10:27:17 +0100
committerHelmut Grohne <helmut@subdivi.de>2022-12-23 10:27:17 +0100
commit82720d195c6b243f8f3a610c555392d20745889b (patch)
tree0133855fe80b4cef7f5b5219f4198ee525592770 /debvm-create
parenta6b2f6ea32ca96dcca10ff9ff647d5153ab4519f (diff)
downloaddebvm-82720d195c6b243f8f3a610c555392d20745889b.tar.gz
debvm-create: conditionalize network workarounds on $DEBVER
Diffstat (limited to 'debvm-create')
-rwxr-xr-xdebvm-create38
1 files 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