pmb.install._install: update comments (MR 1933)

This commit is contained in:
Luca Weiss 2020-05-15 19:15:04 +02:00 committed by Oliver Smith
parent 6bb7f022b1
commit 1356707e9a
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 2 additions and 1 deletions

View File

@ -279,10 +279,11 @@ def setup_hostname(args):
raise RuntimeError("Hostname '" + hostname + "' is not valid, please"
" run 'pmbootstrap init' to configure it.")
# Update /etc/hosts
suffix = "rootfs_" + args.device
# Generate /etc/hostname
pmb.chroot.root(args, ["sh", "-c", "echo " + shlex.quote(hostname) +
" > /etc/hostname"], suffix)
# Update /etc/hosts
regex = (r"s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
" localhost.localdomain localhost/")
pmb.chroot.root(args, ["sed", "-i", "-e", regex, "/etc/hosts"], suffix)