[OE-core] [PATCH] base-files: clean up and clarify hostname logic
Ross Burton
ross.burton at intel.com
Mon Feb 23 14:44:11 UTC 2015
Change the hostname logic so that the magic value to use MACHINE as hostname is
clearly a machine value ("machinename" instead of "openembedded"), and add a
comment explaining how to set the hostname from outside the recipe and what
happens if it's unset.
Signed-off-by: Ross Burton <ross.burton at intel.com>
---
meta/recipes-core/base-files/base-files_3.0.14.bb | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 6157ff3..dd20330 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -59,10 +59,13 @@ conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
${sysconfdir}/default"
+# The default hostname. If set to the magic value "machinename" then the value
+# of MACHINE is used. If the hostname is unset then a /etc/hostname file isn't
+# written, suitable for environments with dynamic hostnames.
#
-# set standard hostname, might be a candidate for a DISTRO variable? :M:
-#
-hostname = "openembedded"
+# This can be changed outside of this recipe by using
+# hostname_pn-base-files = "my-host-name".
+hostname = "machinename"
BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
@@ -111,15 +114,15 @@ do_install () {
DISTRO_VERSION[vardepsexclude] += "DATE"
do_install_basefilesissue () {
- if [ "${hostname}" != "" ]; then
- if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
+ if [ "${hostname}" ]; then
+ if [ "${hostname}" = "machinename" ]; then
echo ${MACHINE} > ${D}${sysconfdir}/hostname
else
echo ${hostname} > ${D}${sysconfdir}/hostname
fi
fi
- install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
if [ -n "${DISTRO_NAME}" ]; then
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
--
1.7.10.4
More information about the Openembedded-core
mailing list