[yocto] [PATCH] hostname.sh: remove warning for bashism

Khem Raj raj.khem at gmail.com
Tue Feb 27 19:50:57 PST 2018



On 2/27/18 2:58 PM, Ulf Samuelsson wrote:
> The use of the environment variable HOSTNAME, triggers
> the checkbashisms script, so change HOSTNAME to LOCALHOST
> 
> Signed-off-by: Ulf Samuelsson <ulf at emagii.com>
> ---
>   meta/recipes-core/initscripts/initscripts-1.0/hostname.sh | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh 
> b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
> index 95287cc..f4ba2b8 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
> @@ -7,7 +7,7 @@
>   # Default-Stop:
>   # Short-Description: Set hostname based on /etc/hostname
>   ### END INIT INFO
> -HOSTNAME=$(/bin/hostname)
> +LOCALHOST=$(/bin/hostname)
> 
>   hostname -b -F /etc/hostname 2> /dev/null
>   if [ $? -eq 0 ]; then
> @@ -17,6 +17,6 @@ fi
>   # Busybox hostname doesn't support -b so we need implement it on our own
>   if [ -f /etc/hostname ];then
>       hostname `cat /etc/hostname`
> -elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo 
> $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
> +elif [ -z "$LOCALHOST" -o "$LOCALHOST" = "(none)" -o ! -z "`echo 
> $LOCALHOST | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
>       hostname localhost
>   fi


I see buildhistory_commit() is also using HOSTNAME in shell functions
in meta/classes/buildhistory.bbclass should that be changed too ?



More information about the yocto mailing list