Contents of /trunk/magellan-initscripts/rc/rc
Parent Directory | Revision Log
Revision 1095 -
(show annotations)
(download)
Wed Jul 14 13:11:03 2010 UTC (14 years, 2 months ago) by niro
Original Path: trunk/magellan-initscripts/etc/rc.d/init.d/rc
File size: 5102 byte(s)
Wed Jul 14 13:11:03 2010 UTC (14 years, 2 months ago) by niro
Original Path: trunk/magellan-initscripts/etc/rc.d/init.d/rc
File size: 5102 byte(s)
-only use udev|mdev overrides when the rc script exist
1 | #!/bin/bash |
2 | # $Id$ |
3 | |
4 | source /etc/conf.d/rc |
5 | source ${rc_functions} |
6 | |
7 | # get mage version |
8 | MAGEVER="$(< /etc/mageversion)" |
9 | |
10 | # source kernel config if exists |
11 | [ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
12 | |
13 | # override devicemanager helper functions |
14 | if [[ ${RC_DEVICEMANAGER} = udev ]] && [[ -f ${rc_base}/init.d/udev ]] |
15 | then |
16 | source ${rc_base}/init.d/udev |
17 | |
18 | elif [[ ${RC_DEVICEMANAGER} = mdev ]] && [[ -f source ${rc_base}/init.d/mdev ]] |
19 | then |
20 | source ${rc_base}/init.d/mdev |
21 | fi |
22 | |
23 | trap "" INT QUIT TSTP |
24 | |
25 | [ "$1" != "" ] && runlevel=$1 |
26 | |
27 | if [[ $runlevel = sysinit ]] |
28 | then |
29 | echo |
30 | echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
31 | echo -e "Copyright 2001-2010 Niels Rogalla; http://magellan-linux.net" |
32 | echo |
33 | |
34 | # mount proc filesystem, needed for bootsplash; |
35 | # no use of '/etc/rc.d/init.d/mountproc' anymore |
36 | 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 | # set default verbose level for kernel messages |
44 | [ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
45 | echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
46 | |
47 | # mount sys file system before udev |
48 | if [ -d /sys ] |
49 | then |
50 | 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 | fi |
58 | |
59 | |
60 | #### load udev|mdev| #### |
61 | start_devicemanager |
62 | ## end udev|mdev ## |
63 | |
64 | |
65 | ## load devpts ## |
66 | # devfs/udev with 2.6 has no ptys, so devpts is also needed |
67 | # check if we really have devpts support |
68 | if kernel_supports_fs devpts |
69 | then |
70 | # /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 | then |
76 | mkdir -p /dev/pts &> /dev/null || \ |
77 | echo "Could not create /dev/pts !" |
78 | fi |
79 | |
80 | # 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 | fi |
87 | 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 | echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts," |
92 | echo -e ${COLYELLOW}"or no pty's are available." |
93 | echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel." |
94 | echo |
95 | echo -e ${COLYELLOW}"Press any key to continue ..." |
96 | read |
97 | fi |
98 | ## end devpts ## |
99 | |
100 | |
101 | ## 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 | ## end usbfs ## |
109 | |
110 | ## services state dir ## |
111 | 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 | # load bootsplash |
116 | splash "rc_init" "${runlevel}" |
117 | fi |
118 | |
119 | |
120 | if [[ $runlevel = 0 ]] || [[ $runlevel = 6 ]] |
121 | then |
122 | # load bootsplash |
123 | 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 | if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
129 | [ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
130 | then |
131 | echo -e ${COLOREDSTAR}"Saving /dev device nodes ..." |
132 | ( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
133 | mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
134 | evaluate_retval |
135 | fi |
136 | |
137 | # stop udev|mdev now |
138 | stop_devicemanager |
139 | fi |
140 | |
141 | |
142 | if [ "$runlevel" = "" ] |
143 | then |
144 | echo "Usage: $0 <runlevel>" >&2 |
145 | exit 1 |
146 | fi |
147 | |
148 | |
149 | 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 | * |