package/systemd: Set fallback hostname
authorChris Lesiak <chris.lesiak@licor.com>
Tue, 23 Jan 2018 23:15:58 +0000 (17:15 -0600)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 28 Jan 2018 20:47:21 +0000 (21:47 +0100)
When BR2_TARGET_GENERIC_HOSTNAME is set, use the config option
--with-fallback-hostname to specify the fallback hostname to use
if none is configured in /etc/hostname.  This is useful in a
pristine installation with an empty /etc.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/systemd/systemd.mk

index ef31a0f6c6a661edde87914122cd624ae3ee9d93..b56c6c6b26c44f0bac02ce29076ef5c573cb59c3 100644 (file)
@@ -317,6 +317,11 @@ else
 SYSTEMD_CONF_OPTS += -Dhibernate=false
 endif
 
+SYSTEMD_FALLBACK_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
+ifneq ($(SYSTEMD_FALLBACK_HOSTNAME),)
+SYSTEMD_CONF_OPTS += --with-fallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
+endif
+
 define SYSTEMD_INSTALL_INIT_HOOK
        ln -fs ../lib/systemd/systemd $(TARGET_DIR)/sbin/init
        ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/halt