diff options
| author | Carlos Santos <casantos@datacom.com.br> | 2018-10-19 10:58:24 -0300 |
|---|---|---|
| committer | Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> | 2019-01-29 00:12:00 +0100 |
| commit | 01aacbf942198f919ce878d257edc6a47e756e45 (patch) | |
| tree | 19bcbf97519b6a203f080b400221a621781d7d9e | |
| parent | a7d07b5852eb69ad4cd810999d5fa9edec5326ba (diff) | |
| download | buildroot-01aacbf942198f919ce878d257edc6a47e756e45.tar.gz buildroot-01aacbf942198f919ce878d257edc6a47e756e45.zip | |
skeleton-init-common: improve /etc/hosts generation
If BR2_TARGET_GENERIC_HOSTNAME contains a FQDN, strip the host part and
add it as an alias, e.g.
127.0.1.1 hostname.example.com hostname
Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
| -rw-r--r-- | package/skeleton-init-common/skeleton-init-common.mk | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/package/skeleton-init-common/skeleton-init-common.mk b/package/skeleton-init-common/skeleton-init-common.mk index 7d2c68ada3..e429b13d78 100644 --- a/package/skeleton-init-common/skeleton-init-common.mk +++ b/package/skeleton-init-common/skeleton-init-common.mk @@ -42,10 +42,15 @@ SKELETON_INIT_COMMON_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_M SKELETON_INIT_COMMON_BIN_SH = $(call qstrip,$(BR2_SYSTEM_BIN_SH)) ifneq ($(SKELETON_INIT_COMMON_HOSTNAME),) +SKELETON_INIT_COMMON_HOSTS_LINE = $(SKELETON_INIT_COMMON_HOSTNAME) +SKELETON_INIT_COMMON_SHORT_HOSTNAME = $(firstword $(subst ., ,$(SKELETON_INIT_COMMON_HOSTNAME))) +ifneq ($(SKELETON_INIT_COMMON_HOSTNAME),$(SKELETON_INIT_COMMON_SHORT_HOSTNAME)) +SKELETON_INIT_COMMON_HOSTS_LINE += $(SKELETON_INIT_COMMON_SHORT_HOSTNAME) +endif define SKELETON_INIT_COMMON_SET_HOSTNAME mkdir -p $(TARGET_DIR)/etc echo "$(SKELETON_INIT_COMMON_HOSTNAME)" > $(TARGET_DIR)/etc/hostname - $(SED) '$$a \127.0.1.1\t$(SKELETON_INIT_COMMON_HOSTNAME)' \ + $(SED) '$$a \127.0.1.1\t$(SKELETON_INIT_COMMON_HOSTS_LINE)' \ -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts endef SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_SET_HOSTNAME |

