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.
This commit is contained in:
parent
a6c63f9580
commit
231ad89484
|
@ -321,6 +321,10 @@ def setup_hostname(args):
|
||||||
# Generate /etc/hostname
|
# Generate /etc/hostname
|
||||||
pmb.chroot.root(args, ["sh", "-c", "echo " + shlex.quote(hostname) +
|
pmb.chroot.root(args, ["sh", "-c", "echo " + shlex.quote(hostname) +
|
||||||
" > /etc/hostname"], suffix)
|
" > /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
|
# Update /etc/hosts
|
||||||
regex = (r"s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
|
regex = (r"s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
|
||||||
" localhost.localdomain localhost/")
|
" localhost.localdomain localhost/")
|
||||||
|
|
Loading…
Reference in New Issue