summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
commitc527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch)
treebb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
downloadpoky-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0/hostname.sh')
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/hostname.sh22
1 files changed, 22 insertions, 0 deletions
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 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: hostname
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Set hostname based on /etc/hostname
9### END INIT INFO
10HOSTNAME=$(/bin/hostname)
11
12hostname -b -F /etc/hostname 2> /dev/null
13if [ $? -eq 0 ]; then
14 exit
15fi
16
17# Busybox hostname doesn't support -b so we need implement it on our own
18if [ -f /etc/hostname ];then
19 hostname -F /etc/hostname
20elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
21 hostname localhost
22fi