[oe-commits] [openembedded-core] 07/07: netbase: add entry to /etc/hosts according to /etc/hostname

git at git.openembedded.org git at git.openembedded.org
Mon Nov 26 17:20:46 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 8301ca42d84e7b605adfebaec5a6d1a74f0acb76
Author: Chen Qi <Qi.Chen at windriver.com>
AuthorDate: Mon Nov 26 14:56:38 2018 +0800

    netbase: add entry to /etc/hosts according to /etc/hostname
    
    We default hostname to ${MACHINE}, but it's not in /etc/hosts,
    resulting in commands like `hostname -f' failing due to lack
    of entry.
    
    So add entry to /etc/hosts according to /etc/hostname. We do
    this via pkg_postinst because hostname is set in base-files
    recipe.
    
    Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-core/netbase/netbase_5.4.bb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-core/netbase/netbase_5.4.bb b/meta/recipes-core/netbase/netbase_5.4.bb
index 5ab0c58..384c430 100644
--- a/meta/recipes-core/netbase/netbase_5.4.bb
+++ b/meta/recipes-core/netbase/netbase_5.4.bb
@@ -23,3 +23,12 @@ do_install () {
 }
 
 CONFFILES_${PN} = "${sysconfdir}/hosts"
+
+RDEPENDS_${PN} += "base-files"
+
+pkg_postinst_${PN} () {
+	if [ -s $D/etc/hostname ]; then
+		hostname=`cat $D/etc/hostname`
+		echo "127.0.1.1 $hostname" >> $D/etc/hosts
+	fi
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list