On Wed, Dec 26, 2018 at 5:06 PM Jacob Kroon <[email protected]> wrote: > > On Fri, Nov 30, 2018 at 3:18 AM Chen Qi <[email protected]> wrote: > > > > 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 <[email protected]> > > --- > > meta/recipes-core/netbase/netbase_5.4.bb | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/meta/recipes-core/netbase/netbase_5.4.bb > > b/meta/recipes-core/netbase/netbase_5.4.bb > > index 5ab0c58..da9255a 100644 > > --- a/meta/recipes-core/netbase/netbase_5.4.bb > > +++ b/meta/recipes-core/netbase/netbase_5.4.bb > > @@ -23,3 +23,14 @@ do_install () { > > } > > > > CONFFILES_${PN} = "${sysconfdir}/hosts" > > + > > +RDEPENDS_${PN} += "base-files" > > + > > +pkg_postinst_${PN} () { > > + if [ -s $D${sysconfdir}/hostname ]; then > > + hostname=`cat $D${sysconfdir}/hostname` > > + if ! grep -q "[[:space:]]$hostname[[:space:]]*" > > $D${sysconfdir}/hosts; then > > + echo "127.0.1.1 $hostname" >> $D${sysconfdir}/hosts > > Shouldn't that be "127.0.0.1" ? >
I thought it was a typo, but apparently there are reasons for using 127.0.1.1: https://serverfault.com/questions/363095/why-does-my-hostname-appear-with-the-address-127-0-1-1-rather-than-127-0-0-1-in Sorry for the noise. > > + fi > > + fi > > +} > > -- > > 1.9.1 > > > > -- > > _______________________________________________ > > Openembedded-core mailing list > > [email protected] > > http://lists.openembedded.org/mailman/listinfo/openembedded-core -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
