diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2018-11-26 14:56:38 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-27 22:12:27 +0000 |
commit | 21e57d70f4c6780829728e6e987e111e8b38cabb (patch) | |
tree | 19aa30782d737805c4440cea8b0c945e48899b10 | |
parent | 21387613fec1a8c142ed48d7a74d587e205b0c98 (diff) | |
download | openembedded-core-contrib-21e57d70f4c6780829728e6e987e111e8b38cabb.tar.gz |
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@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/netbase/netbase_5.4.bb | 9 |
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 +} |