[oe-commits] [openembedded-core] 01/02: netbase: add entry to /etc/hosts according to /etc/hostname
git at git.openembedded.org
git at git.openembedded.org
Tue Nov 27 22:16:41 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 21e57d70f4c6780829728e6e987e111e8b38cabb
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