diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:38:32 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:50:20 +0100 |
commit | e2e6f6fe07049f33cb6348780fa975162752e421 (patch) | |
tree | b1813295411235d1297a0ed642b1346b24fdfb12 /meta/recipes-core/initscripts/initscripts-1.0/hostname.sh | |
download | poky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz |
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0/hostname.sh')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/hostname.sh | 22 |
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 | ||
10 | HOSTNAME=$(/bin/hostname) | ||
11 | |||
12 | hostname -b -F /etc/hostname 2> /dev/null | ||
13 | if [ $? -eq 0 ]; then | ||
14 | exit | ||
15 | fi | ||
16 | |||
17 | # Busybox hostname doesn't support -b so we need implement it on our own | ||
18 | if [ -f /etc/hostname ];then | ||
19 | hostname -F /etc/hostname | ||
20 | elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then | ||
21 | hostname localhost | ||
22 | fi | ||