summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create26
1 files changed, 5 insertions, 21 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index 0dc619b..9d637b1 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -97,6 +97,8 @@ SSHKEY=
SUITE=unstable
VMNAME=testvm
+SHARE_DIR="${0%/*}/../share"
+
nth_arg() {
shift "$1"
printf "%s" "$1"
@@ -255,14 +257,7 @@ fi
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
+set -- "--customize-hook=$SHARE_DIR/customize-resolved.sh" "$@"
# construct mmdebstrap options as $@:
set -- \
@@ -285,15 +280,7 @@ set -- \
set -- '--customize-hook=chroot "$1" passwd --delete root' "$@"
# dhcp on all network interfaces
-SYSD_NET_MATCH='Name=en*\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.
-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"' \
- "$@"
+set -- "--customize-hook=$SHARE_DIR/customize-networkd.sh" "$@"
# add ssh key for root
if test -n "$SSHKEY"; then
@@ -320,10 +307,7 @@ if test "$DEBVER" -ge 12; then
set -- --hook-dir=/usr/share/mmdebstrap/hooks/merged-usr "$@"
fi
-set -- \
- '--customize-hook=mkdir "$1/etc/systemd/system/serial-getty@.service.d"' \
- "--customize-hook=sed -n -e '1i[Service]' -e '1iExecStart=' -e 's,^ExecStart=-/sbin/agetty ,&-a root ,p'"' "$1/lib/systemd/system/serial-getty@.service" > "$1/etc/systemd/system/serial-getty@.service.d/autologin.conf"' \
- "$@"
+set -- "--customize-hook=$SHARE_DIR/customize-autologin.sh" "$@"
# suite target mirror
set -- "$@" "$SUITE" "$IMAGE" "deb $MIRROR $SUITE main"