All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file
@ 2012-09-07 21:51 Mark Hatle
  2012-09-07 22:51 ` Richard Purdie
  2012-09-08  8:59 ` Koen Kooi
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Hatle @ 2012-09-07 21:51 UTC (permalink / raw)
  To: openembedded-core

From: Mark Asselstine <mark.asselstine@windriver.com>

The existence of a /etc/hostname file causes any hostname provided on
the kernel command line or via dhcp to be overwritten by the
initscripts 'init.d/hostname.sh'. This change allows you to set a
value of "" for 'hostname' which will skip the creation of the
/etc/hostname file by the base-files package.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 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 6bab040..cda13f4 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
@@ -107,10 +107,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 [ "${hostname}" != "" ]; then
+		if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
+			echo ${MACHINE} > ${D}${sysconfdir}/hostname
+		else
+			echo ${hostname} > ${D}${sysconfdir}/hostname
+		fi
 	fi
 
 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
@@ -144,5 +146,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-CONFFILES_${PN} = "${sysconfdir}/fstab ${sysconfdir}/hostname"
+CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]}"
 
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file
  2012-09-07 21:51 [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file Mark Hatle
@ 2012-09-07 22:51 ` Richard Purdie
  2012-09-07 23:08   ` Mark Hatle
  2012-09-08  8:59 ` Koen Kooi
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2012-09-07 22:51 UTC (permalink / raw)
  To: Mark Hatle; +Cc: openembedded-core

On Fri, 2012-09-07 at 16:51 -0500, Mark Hatle wrote:
> From: Mark Asselstine <mark.asselstine@windriver.com>
> 
> The existence of a /etc/hostname file causes any hostname provided on
> the kernel command line or via dhcp to be overwritten by the
> initscripts 'init.d/hostname.sh'. This change allows you to set a
> value of "" for 'hostname' which will skip the creation of the
> /etc/hostname file by the base-files package.
> 
> Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  meta/recipes-core/base-files/base-files_3.0.14.bb |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 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 6bab040..cda13f4 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
> @@ -107,10 +107,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 [ "${hostname}" != "" ]; then
> +		if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
> +			echo ${MACHINE} > ${D}${sysconfdir}/hostname
> +		else
> +			echo ${hostname} > ${D}${sysconfdir}/hostname
> +		fi
>  	fi


Is this missing a hostname ??= "openembedded" perhaps?

Cheers,

Richard

>  	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
> @@ -144,5 +146,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
>  
>  PACKAGE_ARCH = "${MACHINE_ARCH}"
>  
> -CONFFILES_${PN} = "${sysconfdir}/fstab ${sysconfdir}/hostname"
> +CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]}"
>  





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file
  2012-09-07 22:51 ` Richard Purdie
@ 2012-09-07 23:08   ` Mark Hatle
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Hatle @ 2012-09-07 23:08 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

On 9/7/12 5:51 PM, Richard Purdie wrote:
> On Fri, 2012-09-07 at 16:51 -0500, Mark Hatle wrote:
>> From: Mark Asselstine <mark.asselstine@windriver.com>
>>
>> The existence of a /etc/hostname file causes any hostname provided on
>> the kernel command line or via dhcp to be overwritten by the
>> initscripts 'init.d/hostname.sh'. This change allows you to set a
>> value of "" for 'hostname' which will skip the creation of the
>> /etc/hostname file by the base-files package.
>>
>> Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
>> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
>> ---
>>   meta/recipes-core/base-files/base-files_3.0.14.bb |   12 +++++++-----
>>   1 files changed, 7 insertions(+), 5 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 6bab040..cda13f4 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
>> @@ -107,10 +107,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 [ "${hostname}" != "" ]; then
>> +		if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
>> +			echo ${MACHINE} > ${D}${sysconfdir}/hostname
>> +		else
>> +			echo ${hostname} > ${D}${sysconfdir}/hostname
>> +		fi
>>   	fi
>
>
> Is this missing a hostname ??= "openembedded" perhaps?

There is already a hostname = "openembedded" in the package.  Nothing in that 
part was changed by this patch.  The normal override process is to define 
hostname_override = "newhostname".

I verified this is working properly.

--Mark

> Cheers,
>
> Richard
>
>>   	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}
>> @@ -144,5 +146,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
>>
>>   PACKAGE_ARCH = "${MACHINE_ARCH}"
>>
>> -CONFFILES_${PN} = "${sysconfdir}/fstab ${sysconfdir}/hostname"
>> +CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]}"
>>
>
>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file
  2012-09-07 21:51 [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file Mark Hatle
  2012-09-07 22:51 ` Richard Purdie
@ 2012-09-08  8:59 ` Koen Kooi
  1 sibling, 0 replies; 4+ messages in thread
From: Koen Kooi @ 2012-09-08  8:59 UTC (permalink / raw)
  To: Mark Hatle; +Cc: openembedded-core


Op 7 sep. 2012, om 23:51 heeft Mark Hatle <mark.hatle@windriver.com> het volgende geschreven:

> From: Mark Asselstine <mark.asselstine@windriver.com>
> 
> The existence of a /etc/hostname file causes any hostname provided on
> the kernel command line or via dhcp to be overwritten by the
> initscripts 'init.d/hostname.sh'. This change allows you to set a
> value of "" for 'hostname' which will skip the creation of the
> /etc/hostname file by the base-files package.
> 
> Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
> meta/recipes-core/base-files/base-files_3.0.14.bb |   12 +++++++-----
> 1 files changed, 7 insertions(+), 5 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 6bab040..cda13f4 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
> @@ -107,10 +107,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 [ "${hostname}" != "" ]; then
> +		if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
> +			echo ${MACHINE} > ${D}${sysconfdir}/hostname
> +		else
> +			echo ${hostname} > ${D}${sysconfdir}/hostname
> +		fi
> 	fi
> 
> 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
> @@ -144,5 +146,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
> 
> PACKAGE_ARCH = "${MACHINE_ARCH}"
> 
> -CONFFILES_${PN} = "${sysconfdir}/fstab ${sysconfdir}/hostname"
> +CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]}"

MIssing PR bump


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-08  9:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 21:51 [PATCH V3] base-files: provide a mechanism to skip creation of the hostname file Mark Hatle
2012-09-07 22:51 ` Richard Purdie
2012-09-07 23:08   ` Mark Hatle
2012-09-08  8:59 ` Koen Kooi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.