From 4c6ca3d4eb032b071d5599402858a6eb787bf78b Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Thu, 27 Mar 2025 12:04:53 +0100
Subject: fix deletion of root password again

Unless passwd is installed, shadow is not enabled. That is, shadow being
enabled is not a boolean. It can be enabled per user and systemd enables
it for its own users, so shadow exists, but may not contain the root
user. Thus the password deletion logic need a bit more fancyness for
covering systems that lack the passwd package.
---
 bin/debvm-create | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'bin')

diff --git a/bin/debvm-create b/bin/debvm-create
index 9ab2472..0d89ad4 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -356,10 +356,7 @@ set -- \
 	"$@"
 
 # allow password-less root login
-# In future, we should use passwd --prefix "$1" --delete root here, but the
-# --prefix option was added in trixie and the --root option uses chroot() and
-# attempts to load shared libraries from a potentially foreign chroot.
-set -- '--customize-hook=sed -i -e "s/^root:[*]:/root::/" "$1/etc/shadow"' "$@"
+set -- "--customize-hook=$SHARE_DIR/customize-delete-rootpw.sh" "$@"
 
 if test "$INITSYSTEM" = systemd && ! check_skip systemdnetwork; then
 	# dhcp on all network interfaces, and add a dns resolver
-- 
cgit v1.2.3