Magellan Linux

Annotation of /trunk/initscripts/sysvinit/rc/rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1105 - (hide annotations) (download)
Wed Jul 14 14:37:57 2010 UTC (13 years, 10 months ago) by niro
Original Path: trunk/magellan-initscripts/etc/rc.d/init.d/rc
File size: 5095 byte(s)
-fixed a very bad typo
1 niro 2 #!/bin/bash
2 niro 935 # $Id$
3 niro 2
4 niro 781 source /etc/conf.d/rc
5     source ${rc_functions}
6 niro 2
7 niro 50 # get mage version
8     MAGEVER="$(< /etc/mageversion)"
9 niro 2
10 niro 150 # source kernel config if exists
11 niro 2 [ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel
12    
13 niro 1094 # override devicemanager helper functions
14 niro 1095 if [[ ${RC_DEVICEMANAGER} = udev ]] && [[ -f ${rc_base}/init.d/udev ]]
15 niro 1094 then
16     source ${rc_base}/init.d/udev
17    
18 niro 1105 elif [[ ${RC_DEVICEMANAGER} = mdev ]] && [[ -f ${rc_base}/init.d/mdev ]]
19 niro 1094 then
20     source ${rc_base}/init.d/mdev
21     fi
22    
23 niro 2 trap "" INT QUIT TSTP
24    
25     [ "$1" != "" ] && runlevel=$1
26    
27 niro 150 if [[ $runlevel = sysinit ]]
28 niro 2 then
29     echo
30     echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}"
31 niro 960 echo -e "Copyright 2001-2010 Niels Rogalla; http://magellan-linux.net"
32 niro 2 echo
33    
34 niro 150 # mount proc filesystem, needed for bootsplash;
35     # no use of '/etc/rc.d/init.d/mountproc' anymore
36 niro 2 if [ ! -e /proc/mounts ]
37     then
38     echo -e ${COLOREDSTAR}"Mounting proc file system ..."
39     mount -n /proc
40     evaluate_retval
41     fi
42    
43 niro 150 # set default verbose level for kernel messages
44 niro 2 [ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3
45     echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk
46    
47 niro 692 # mount sys file system before udev
48     if [ -d /sys ]
49 niro 2 then
50 niro 692 echo -e ${COLOREDSTAR}"Mounting sysfs file system ..."
51     mount -n -t sysfs sysfs /sys
52     evaluate_retval
53     else
54     echo -e ${COLORED}"Fatal: mountpoint /sys missing ..."
55     echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)."
56     echo -e ${COLYELLOW}"It's essential for a 2.6 kernel."
57 niro 2 fi
58    
59    
60 niro 1094 #### load udev|mdev| ####
61     start_devicemanager
62     ## end udev|mdev ##
63 niro 318
64 niro 2
65     ## load devpts ##
66     # devfs/udev with 2.6 has no ptys, so devpts is also needed
67 niro 692 # check if we really have devpts support
68     if kernel_supports_fs devpts
69 niro 2 then
70 niro 692 # /dev/pts maybe not exists.
71     # We only create this directory only if devfs was mounted,
72     # or it will fail as / is still mounted readonly
73     # udev has this dir already, only a sanity check for devfs
74     if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs
75 niro 2 then
76 niro 692 mkdir -p /dev/pts &> /dev/null || \
77     echo "Could not create /dev/pts !"
78     fi
79 niro 71
80 niro 692 # now mount devpts
81     if [ -d /dev/pts ]
82     then
83     echo -e ${COLOREDSTAR}"Mounting devpts at /dev/pts ..."
84     mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts
85     evaluate_retval
86 niro 2 fi
87 niro 692 else
88     # devpts is not supported, give a warning
89     echo -e ${COLRED}"No devpts filesystem found ..."
90     echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem."
91 niro 783 echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts,"
92 niro 692 echo -e ${COLYELLOW}"or no pty's are available."
93 niro 783 echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel."
94 niro 692 echo
95     echo -e ${COLYELLOW}"Press any key to continue ..."
96     read
97 niro 2 fi
98 niro 692 ## end devpts ##
99 niro 2
100 niro 692
101 niro 515 ## load usbfs ##
102     if kernel_supports_fs usbfs
103     then
104     echo -e ${COLOREDSTAR}"Mounting usbfs at /proc/bus/usb ..."
105     mount -n -t usbfs usbfs /proc/bus/usb
106     evaluate_retval
107     fi
108 niro 692 ## end usbfs ##
109 niro 515
110 niro 692 ## services state dir ##
111 niro 2 echo -e ${COLOREDSTAR}"Mounting tmpfs at ${svcdir} ..."
112     mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k
113     evaluate_retval
114    
115 niro 150 # load bootsplash
116 niro 2 splash "rc_init" "${runlevel}"
117     fi
118    
119    
120 niro 150 if [[ $runlevel = 0 ]] || [[ $runlevel = 6 ]]
121 niro 2 then
122 niro 150 # load bootsplash
123 niro 2 splash "rc_init" "${runlevel}"
124    
125     # if requested save devices to a device tarball before halt
126     # only for kernels >=2.6 *and* udev
127     # make shure that udev is mounted but *not* devfs --> /dev/.devfsd
128 niro 150 if [[ ${RC_DEVICE_TARBALL} = yes ]] && \
129     [ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ]
130 niro 2 then
131     echo -e ${COLOREDSTAR}"Saving /dev device nodes ..."
132 niro 150 ( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null )
133 niro 694 mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2
134 niro 2 evaluate_retval
135     fi
136 niro 974
137 niro 1094 # stop udev|mdev now
138     stop_devicemanager
139 niro 2 fi
140    
141    
142     if [ "$runlevel" = "" ]
143     then
144     echo "Usage: $0 <runlevel>" >&2
145     exit 1
146     fi
147    
148 niro 150
149 niro 2 previous=$PREVLEVEL
150     [ "$previous" = "" ] && previous=N
151    
152     if [ ! -d $rc_base/rc$runlevel.d ]
153     then
154     echo "$rc_base/rc$runlevel.d does not exist"
155     exit 1
156     fi
157    
158     if [ "$previous" != "N" ]
159     then
160     for i in $(ls -v $rc_base/rc$runlevel.d/K* 2> /dev/null)
161     do
162    
163     check_script_status
164    
165     suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
166     prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
167     sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
168    
169     if [ "$runlevel" != "0" ] && [ "$runlevel" != "6" ]
170     then
171     if [ ! -f $prev_start ] && [ ! -f $sysinit_start ]
172     then
173     $WARNING
174     echo "$i can't be executed because it was"
175     echo "not started in the previous runlevel ($previous)"
176     $NORMAL
177     continue
178     fi
179     fi
180    
181     $i stop
182     error_value=$?
183    
184     if [ "$error_value" != "0" ]
185     then
186     print_error_msg
187     fi
188     done
189     fi
190    
191     for i in $( ls -v $rc_base/rc$runlevel.d/S* 2> /dev/null)
192     do
193     if [ "$previous" != "N" ]
194     then
195     suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
196     stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
197     prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
198    
199     [ -f $prev_start ] && [ ! -f $stop ] && continue
200     fi
201    
202     check_script_status
203    
204     $i start
205     error_value=$?
206    
207     if [ "$error_value" != "0" ]
208     then
209     print_error_msg
210     fi
211     done

Properties

Name Value
svn:executable *