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

Ulf Samuelsson yocto at emagii.com
Thu Mar 1 20:58:45 PST 2018


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
-- 
1.9.1



More information about the yocto mailing list