summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2025-03-29 12:49:10 +0100
committerHelmut Grohne <helmut@subdivi.de>2025-03-29 12:49:10 +0100
commitd60586f47e277ef1f241963099bf96ab4811f67e (patch)
tree94aed73b3338e0bee87540a3e664b54482dbd454 /bin/debvm-create
parent1f768f1dae33667b5486678f6282a2fe3a530b66 (diff)
downloaddebvm-d60586f47e277ef1f241963099bf96ab4811f67e.tar.gz
debvm-create: create a more sensible /etc/hosts
This is close to what the debian installer sets up.
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index 0d89ad4..f6cd90a 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -350,9 +350,10 @@ case "$INITSYSTEM" in
esac
# set up a hostname
+ETC_HOSTS_TEMPLATE='127.0.0.1 localhost\n127.0.1.1 %s\n::1 ip6-localhost ip6-loopback\n'
set -- \
- "--customize-hook=echo $VMNAME >"'"$1/etc/hostname"' \
- "--customize-hook=echo 127.0.0.1 localhost $VMNAME >"'"$1/etc/hosts"' \
+ "--customize-hook=echo '$VMNAME' >"'"$1/etc/hostname"' \
+ "--customize-hook=printf '$ETC_HOSTS_TEMPLATE' '$VMNAME' >"'"$1/etc/hosts"' \
"$@"
# allow password-less root login