Compare commits

...

1 Commits

Author SHA1 Message Date
Oliver Smith 231ad89484
install: write /etc/conf.d/hostname too
Write the hostname to this file, so NetworkManager picks it up and
doesn't attempt to fetch and apply a hostname via DHCP.
2021-08-15 23:02:39 +02:00
1 changed files with 4 additions and 0 deletions

View File

@ -321,6 +321,10 @@ def setup_hostname(args):
# Generate /etc/hostname
pmb.chroot.root(args, ["sh", "-c", "echo " + shlex.quote(hostname) +
" > /etc/hostname"], suffix)
# Generate /etc/conf.d/hostname (pma#768)
line = f"hostname={shlex.quote(hostname)}"
cmd = ["sh", "-c", f"echo {shlex.quote(line)} > /etc/conf.d/hostname"]
pmb.chroot.root(args, cmd, suffix)
# Update /etc/hosts
regex = (r"s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
" localhost.localdomain localhost/")