From c527fd1f14c27855a37f2e8ac5346ce8d940ced2 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Thu, 16 Oct 2014 03:05:19 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- .../initscripts/initscripts-1.0/hostname.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 meta/recipes-core/initscripts/initscripts-1.0/hostname.sh (limited to 'meta/recipes-core/initscripts/initscripts-1.0/hostname.sh') diff --git a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh new file mode 100755 index 0000000000..78fb91c409 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh @@ -0,0 +1,22 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: hostname +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set hostname based on /etc/hostname +### END INIT INFO +HOSTNAME=$(/bin/hostname) + +hostname -b -F /etc/hostname 2> /dev/null +if [ $? -eq 0 ]; then + exit +fi + +# Busybox hostname doesn't support -b so we need implement it on our own +if [ -f /etc/hostname ];then + hostname -F /etc/hostname +elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then + hostname localhost +fi -- cgit v1.2.3-54-g00ecf