* [PATCH] base-files: allow for more flexibility related to hostname
@ 2012-08-27 15:24 Mark Asselstine
2012-08-28 6:47 ` Koen Kooi
0 siblings, 1 reply; 4+ messages in thread
From: Mark Asselstine @ 2012-08-27 15:24 UTC (permalink / raw)
To: openembedded-core
Current logic used to create the /etc/hostname file is fairly
restrictive and doesn't allow for easy customization since the
variable 'hostname' is local to the base-files recipe. Changing
'hostname' to a globally recognized variable which can be overwritten
overcomes these restrictions. Additionally it is not always desirable
to establish a /etc/hostname file, such as when we want to define the
hostname via dhcp or using the kernel command line, so we provide a
mechanism to skip its creation.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
---
meta/conf/local.conf.sample | 11 +++++++++++
meta/recipes-core/base-files/base-files_3.0.14.bb | 15 +++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/meta/conf/local.conf.sample b/meta/conf/local.conf.sample
index 5679c03..50696e4 100644
--- a/meta/conf/local.conf.sample
+++ b/meta/conf/local.conf.sample
@@ -43,6 +43,17 @@
MACHINE ??= "qemux86"
#
+# Hostname
+#
+# The openembedded default is to write a '${sysconfdir}/hostname' file which
+# will have ${MACHINE} as the hostname. If you want to use a different hostname
+# set it here. You may also set this to 'none' which will forgo the creation of
+# the '${sysconfdir}/hostname' file allowing, for example, the hostname to be
+# provided by your dhcp configuration or via the kernel command line.
+#
+#MACHINE_HOSTNAME ?= "none"
+
+#
# Where to place downloads
#
# During a first build the system will download many different source code tarballs
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 6bab040..571eded 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
@@ -60,10 +60,7 @@ conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
${sysconfdir}/default"
-#
-# set standard hostname, might be a candidate for a DISTRO variable? :M:
-#
-hostname = "openembedded"
+MACHINE_HOSTNAME ?= "openembedded"
BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
@@ -107,10 +104,12 @@ do_install () {
}
do_install_basefilesissue () {
- if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
- echo ${MACHINE} > ${D}${sysconfdir}/hostname
- else
- echo ${hostname} > ${D}${sysconfdir}/hostname
+ if [ "${MACHINE_HOSTNAME}" != "none" ]; then
+ if [ -n "${MACHINE}" -a "${MACHINE_HOSTNAME}" = "openembedded" ]; then
+ echo ${MACHINE} > ${D}${sysconfdir}/hostname
+ else
+ echo ${MACHINE_HOSTNAME} > ${D}${sysconfdir}/hostname
+ fi
fi
install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] base-files: allow for more flexibility related to hostname
2012-08-27 15:24 [PATCH] base-files: allow for more flexibility related to hostname Mark Asselstine
@ 2012-08-28 6:47 ` Koen Kooi
2012-08-28 13:45 ` Mark Asselstine
0 siblings, 1 reply; 4+ messages in thread
From: Koen Kooi @ 2012-08-28 6:47 UTC (permalink / raw)
To: Mark Asselstine; +Cc: openembedded-core
Op 27 aug. 2012, om 17:24 heeft Mark Asselstine <mark.asselstine@windriver.com> het volgende geschreven:
> Current logic used to create the /etc/hostname file is fairly
> restrictive and doesn't allow for easy customization since the
> variable 'hostname' is local to the base-files recipe.
hostname_pn-basefiles_someotheroverride = "foo"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] base-files: allow for more flexibility related to hostname
2012-08-28 6:47 ` Koen Kooi
@ 2012-08-28 13:45 ` Mark Asselstine
2012-08-28 15:22 ` Koen Kooi
0 siblings, 1 reply; 4+ messages in thread
From: Mark Asselstine @ 2012-08-28 13:45 UTC (permalink / raw)
To: Koen Kooi; +Cc: openembedded-core
On August 28, 2012 08:47:33 Koen Kooi wrote:
> Op 27 aug. 2012, om 17:24 heeft Mark Asselstine
<mark.asselstine@windriver.com> het volgende geschreven:
> > Current logic used to create the /etc/hostname file is fairly
> > restrictive and doesn't allow for easy customization since the
> > variable 'hostname' is local to the base-files recipe.
>
> hostname_pn-basefiles_someotheroverride = "foo"
Point taken. Do you object to the attempt at making it less obscure however?
Any thoughts about the second part to this, not creating the /etc/hostname
file? Without being able to avoid the creation of /etc/hostname the
initscripts 'init.d/hostname.sh' will set the hostname overwriting what is set
by the kernel cmdline or dhcp.
Thanks for the feedback,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] base-files: allow for more flexibility related to hostname
2012-08-28 13:45 ` Mark Asselstine
@ 2012-08-28 15:22 ` Koen Kooi
0 siblings, 0 replies; 4+ messages in thread
From: Koen Kooi @ 2012-08-28 15:22 UTC (permalink / raw)
To: Mark Asselstine; +Cc: openembedded-core
Op 28 aug. 2012, om 15:45 heeft Mark Asselstine <mark.asselstine@windriver.com> het volgende geschreven:
> On August 28, 2012 08:47:33 Koen Kooi wrote:
>> Op 27 aug. 2012, om 17:24 heeft Mark Asselstine
> <mark.asselstine@windriver.com> het volgende geschreven:
>>> Current logic used to create the /etc/hostname file is fairly
>>> restrictive and doesn't allow for easy customization since the
>>> variable 'hostname' is local to the base-files recipe.
>>
>> hostname_pn-basefiles_someotheroverride = "foo"
>
> Point taken. Do you object to the attempt at making it less obscure however?
Yes, since that was the outcome of the discussion in this list not so long ago.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-28 15:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 15:24 [PATCH] base-files: allow for more flexibility related to hostname Mark Asselstine
2012-08-28 6:47 ` Koen Kooi
2012-08-28 13:45 ` Mark Asselstine
2012-08-28 15:22 ` Koen Kooi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox