From 231ad89484f2ce4e789abd55f4d79d03b5e93e27 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 15 Aug 2021 22:44:15 +0200 Subject: [PATCH] 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. --- pmb/install/_install.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pmb/install/_install.py b/pmb/install/_install.py index a28f21d3..8161baf0 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -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/")