[poky] [PATCH] base-files: Let user set hostname

J. Tang tang at jtang.org
Sat Feb 21 17:58:26 PST 2015


By default, poky always sets the hostname to machine type. This adds
the environment variable $MACHINE_HOSTNAME that holds the intended
hostname. If set, it overrides any default hostnames. The user can set
$MACHINE_HOSTNAME within his/her local.conf.

Signed-off-by: Jason Tang <tang at jtang.org>
---
 meta/conf/documentation.conf                      |    1 +
 meta/recipes-core/base-files/base-files_3.0.14.bb |    3 +++
 2 files changed, 4 insertions(+)

diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 3a918e8..28d5a61 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -276,6 +276,7 @@ MACHINE_EXTRA_RRECOMMENDS[doc] = "A list of machine-specific packages to install
 MACHINE_FEATURES[doc] = "Specifies the list of hardware features the MACHINE supports."
 MACHINE_FEATURES_BACKFILL[doc] = "Features to be added to MACHINE_FEATURES if not also present in MACHINE_FEATURES_BACKFILL_CONSIDERED. This variable is set in the meta/conf/bitbake.conf file and is not intended to be user-configurable."
 MACHINE_FEATURES_BACKFILL_CONSIDERED[doc] = "Features from MACHINE_FEATURES_BACKFILL that should not be backfilled (i.e. added to MACHINE_FEATURES) during the build."
+MACHINE_HOSTNAME[doc] = "Hostname for the target system"
 MACHINEOVERRIDES[doc] = "Lists overrides specific to the current machine. By default, this list includes the value of MACHINE."
 MAINTAINER[doc] = "The email address of the distribution maintainer."
 MIRRORS[doc] = "Specifies additional paths from which the OpenEmbedded build system gets source code."
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..a494853 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
@@ -118,6 +118,9 @@ do_install_basefilesissue () {
 			echo ${hostname} > ${D}${sysconfdir}/hostname
 		fi
 	fi
+	if [ -n "${MACHINE_HOSTNAME}" ]; then
+		echo "${MACHINE_HOSTNAME}" > ${D}${sysconfdir}/hostname
+	fi
 
 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
         if [ -n "${DISTRO_NAME}" ]; then
-- 
1.7.10.4




More information about the poky mailing list