aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-11-26 14:56:38 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-26 17:19:13 +0000
commit8301ca42d84e7b605adfebaec5a6d1a74f0acb76 (patch)
treee8e92c27be448684bf6213f7cd69666103c12ab5
parent5785c5d1c2328a7fd1fc3f74a4dbcfb6cba0e885 (diff)
downloadopenembedded-core-contrib-master-next.tar.gz
openembedded-core-contrib-master-next.tar.bz2
openembedded-core-contrib-master-next.zip
netbase: add entry to /etc/hosts according to /etc/hostnamemaster-next
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@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/netbase/netbase_5.4.bb9
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/recipes-core/netbase/netbase_5.4.bb b/meta/recipes-core/netbase/netbase_5.4.bb
index 5ab0c58f83..384c430378 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
+}