~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/initscripts/etc/init.d/hostname.sh

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2008-08-12 16:07:50 UTC
  • Revision ID: james.westby@ubuntu.com-20080812160750-65gpyv74vh4qr69w
Tags: 2.86.ds1-61
* Fix typo in rcS(5), proberly->properly (Closes: #484233).  Thanks to
  Julien Danjou for noticing.
* Fix typo in rcS(5), maually->manually (Closes: #493680).  Thanks to
  Xr for noticing.
* Modify runlevel detection code in invoke-rc.d to notice the
  difference between runlevels 0 and 6, and the boot runlevel, to
  make it possible to use invoke-rc.d during boot (Closes: 384509).
* Make sure to call restorecon after mounting tmpfs file systems, to
  set SELinux permissions (Closes: #493679).  Patch from Russell
  Coker.
* Move responsibility of stopping the splash screen process from
  individual init.d scripts to init.d/rc.  This make sure the
  progress calculation reflect reality, and that the splash screen
  is taken down in runlevel 1 (Closes: #431560) and that it stop
  before gdm and kdm (Closes: #422922, #489734).
* Skip error message from checkfs.sh when / is read-only.  Patch
  from Mirek Slugen (Closes: #492214).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# hostname.sh   Set hostname.
3
 
#
4
 
# Version:      @(#)hostname.sh  1.10  26-Feb-2001  miquels@cistron.nl
5
 
#
6
 
 
7
 
if [ -f /etc/hostname ]
8
 
then
9
 
        hostname --file /etc/hostname
10
 
fi
11
 
 
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          hostname
 
4
# Required-Start:
 
5
# Required-Stop:
 
6
# Should-Start:      glibc
 
7
# Default-Start:     S
 
8
# Default-Stop:
 
9
# Short-Description: Set hostname based on /etc/hostname
 
10
# Description:       Read the machines hostname from /etc/hostname, and
 
11
#                    update the kernel value with this value.  If
 
12
#                    /etc/hostname is empty, the current kernel value
 
13
#                    for hostname is used.  If the kernel value is
 
14
#                    empty, the value 'localhost' is used.
 
15
### END INIT INFO
 
16
 
 
17
PATH=/sbin:/bin
 
18
 
 
19
. /lib/init/vars.sh
 
20
. /lib/lsb/init-functions
 
21
 
 
22
do_start () {
 
23
        [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
 
24
 
 
25
        # Keep current name if /etc/hostname is missing.
 
26
        [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
 
27
 
 
28
        # And set it to 'localhost' if no setting was found
 
29
        [ -z "$HOSTNAME" ] && HOSTNAME=localhost
 
30
 
 
31
        [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
 
32
        hostname "$HOSTNAME"
 
33
        ES=$?
 
34
        [ "$VERBOSE" != no ] && log_action_end_msg $ES
 
35
        exit $ES
 
36
}
 
37
 
 
38
case "$1" in
 
39
  start|"")
 
40
        do_start
 
41
        ;;
 
42
  restart|reload|force-reload)
 
43
        echo "Error: argument '$1' not supported" >&2
 
44
        exit 3
 
45
        ;;
 
46
  stop)
 
47
        # No-op
 
48
        ;;
 
49
  *)
 
50
        echo "Usage: hostname.sh [start|stop]" >&2
 
51
        exit 3
 
52
        ;;
 
53
esac