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

« back to all changes in this revision

Viewing changes to debian/initscripts/etc/init.d/mountdevsubfs.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
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          mountdevsubfs
 
4
# Required-Start:    mountkernfs
 
5
# Required-Stop:
 
6
# Should-Start:      udev
 
7
# Default-Start:     S
 
8
# Default-Stop:
 
9
# Short-Description: Mount special file systems under /dev.
 
10
# Description:       Mount the virtual filesystems the kernel provides
 
11
#                    that ordinarily live under the /dev filesystem.
 
12
### END INIT INFO
 
13
#
 
14
# This script gets called multiple times during boot
 
15
#
 
16
 
 
17
PATH=/lib/init:/sbin:/bin
 
18
TTYGRP=5
 
19
TTYMODE=620
 
20
[ -f /etc/default/devpts ] && . /etc/default/devpts
 
21
 
 
22
TMPFS_SIZE=
 
23
[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
 
24
 
 
25
KERNEL="$(uname -s)"
 
26
 
 
27
. /lib/lsb/init-functions
 
28
. /lib/init/mount-functions.sh
 
29
 
 
30
do_start () {
 
31
        #
 
32
        # Mount a tmpfs on /dev/shm
 
33
        #
 
34
        SHM_OPT=
 
35
        [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
 
36
        domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
 
37
 
 
38
        #
 
39
        # Mount /dev/pts. Create master ptmx node if needed.
 
40
        #
 
41
        # As of 2.5.68, devpts is not automounted when using devfs. So we
 
42
        # mount devpts if it is compiled in (older devfs didn't require it
 
43
        # to be compiled in at all).
 
44
        #
 
45
        if [ "$KERNEL" = Linux ]
 
46
        then
 
47
                #
 
48
                # Since kernel 2.5.something, devfs doesn't include
 
49
                # a standard /dev/pts directory anymore. So if devfs
 
50
                # is mounted on /dev we need to create that directory
 
51
                # manually.
 
52
                #
 
53
                if [ ! -d /dev/pts ]
 
54
                then
 
55
                        if grep -qs '/dev devfs' /proc/mounts
 
56
                        then
 
57
                                mkdir --mode=755 /dev/pts
 
58
                                [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
 
59
                        fi
 
60
                fi
 
61
                if [ -d /dev/pts ]
 
62
                then
 
63
                        if [ ! -c /dev/ptmx ]
 
64
                        then
 
65
                                mknod --mode=666 /dev/ptmx c 5 2
 
66
                                ES=$?
 
67
                                if [ "$ES" != 0 ]
 
68
                                then
 
69
                                        log_warning_msg "Failed making node /dev/ptmx with error code ${ES}."
 
70
                                fi
 
71
                                [ -x /sbin/restorecon ] && /sbin/restorecon /dev/ptmx
 
72
                        fi
 
73
                        domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
 
74
                fi
 
75
        fi
 
76
}
 
77
 
 
78
case "$1" in
 
79
  "")
 
80
        echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
 
81
        do_start
 
82
        ;;
 
83
  start)
 
84
        do_start
 
85
        ;;
 
86
  restart|reload|force-reload)
 
87
        echo "Error: argument '$1' not supported" >&2
 
88
        exit 3
 
89
        ;;
 
90
  stop)
 
91
        # No-op
 
92
        ;;
 
93
  *)
 
94
        echo "Usage: mountdevsubfs [start|stop]" >&2
 
95
        exit 3
 
96
        ;;
 
97
esac