Annotation of /tags/init-0_7_1_2/sysvinit/rc/rc
Parent Directory | Revision Log
Revision 1484 -
(hide annotations)
(download)
Wed Aug 3 23:32:18 2011 UTC (13 years, 1 month ago) by niro
File size: 5052 byte(s)
Wed Aug 3 23:32:18 2011 UTC (13 years, 1 month ago) by niro
File size: 5052 byte(s)
tagged 'init-0_7_1_2'
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 | niro | 1248 | rc_echo |
30 | rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" | ||
31 | rc_echo "Copyright 2001-2011 Niels Rogalla; http://magellan-linux.net" | ||
32 | rc_echo | ||
33 | niro | 2 | |
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 | niro | 1248 | rc_print "Mounting proc file system ..." |
39 | niro | 2 | 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 | 1248 | rc_print "Mounting sysfs file system ..." |
51 | niro | 692 | mount -n -t sysfs sysfs /sys |
52 | evaluate_retval | ||
53 | else | ||
54 | niro | 1248 | rc_echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
55 | rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." | ||
56 | rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." | ||
57 | niro | 2 | fi |
58 | |||
59 | niro | 1248 | # start device management |
60 | niro | 1094 | start_devicemanager |
61 | niro | 318 | |
62 | niro | 2 | ## load devpts ## |
63 | # devfs/udev with 2.6 has no ptys, so devpts is also needed | ||
64 | niro | 692 | # check if we really have devpts support |
65 | if kernel_supports_fs devpts | ||
66 | niro | 2 | then |
67 | niro | 692 | # /dev/pts maybe not exists. |
68 | # We only create this directory only if devfs was mounted, | ||
69 | # or it will fail as / is still mounted readonly | ||
70 | # udev has this dir already, only a sanity check for devfs | ||
71 | if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs | ||
72 | niro | 2 | then |
73 | niro | 692 | mkdir -p /dev/pts &> /dev/null || \ |
74 | niro | 1248 | rc_echo "Could not create /dev/pts !" |
75 | niro | 692 | fi |
76 | niro | 71 | |
77 | niro | 692 | # now mount devpts |
78 | if [ -d /dev/pts ] | ||
79 | then | ||
80 | niro | 1248 | rc_print "Mounting devpts at /dev/pts ..." |
81 | niro | 692 | mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
82 | evaluate_retval | ||
83 | niro | 2 | fi |
84 | niro | 692 | else |
85 | # devpts is not supported, give a warning | ||
86 | niro | 1248 | rc_echo -e ${COLRED}"No devpts filesystem found ..." |
87 | rc_echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." | ||
88 | rc_echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts," | ||
89 | rc_echo -e ${COLYELLOW}"or no pty's are available." | ||
90 | rc_echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel." | ||
91 | rc_echo | ||
92 | rc_echo -e ${COLYELLOW}"Press any key to continue ..." | ||
93 | niro | 692 | read |
94 | niro | 2 | fi |
95 | niro | 692 | ## end devpts ## |
96 | niro | 2 | |
97 | niro | 692 | |
98 | niro | 515 | ## load usbfs ## |
99 | if kernel_supports_fs usbfs | ||
100 | then | ||
101 | niro | 1248 | rc_print "Mounting usbfs at /proc/bus/usb ..." |
102 | niro | 515 | mount -n -t usbfs usbfs /proc/bus/usb |
103 | evaluate_retval | ||
104 | fi | ||
105 | niro | 692 | ## end usbfs ## |
106 | niro | 515 | |
107 | niro | 692 | ## services state dir ## |
108 | niro | 1248 | rc_print "Mounting tmpfs at ${svcdir} ..." |
109 | niro | 2 | mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k |
110 | evaluate_retval | ||
111 | |||
112 | niro | 150 | # load bootsplash |
113 | niro | 2 | splash "rc_init" "${runlevel}" |
114 | fi | ||
115 | |||
116 | |||
117 | niro | 150 | if [[ $runlevel = 0 ]] || [[ $runlevel = 6 ]] |
118 | niro | 2 | then |
119 | niro | 150 | # load bootsplash |
120 | niro | 2 | splash "rc_init" "${runlevel}" |
121 | |||
122 | # if requested save devices to a device tarball before halt | ||
123 | # only for kernels >=2.6 *and* udev | ||
124 | # make shure that udev is mounted but *not* devfs --> /dev/.devfsd | ||
125 | niro | 150 | if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
126 | [ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] | ||
127 | niro | 2 | then |
128 | niro | 1248 | rc_print "Saving /dev device nodes ..." |
129 | niro | 150 | ( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
130 | niro | 694 | mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
131 | niro | 2 | evaluate_retval |
132 | fi | ||
133 | niro | 974 | |
134 | niro | 1248 | # stop device management |
135 | niro | 1094 | stop_devicemanager |
136 | niro | 2 | fi |
137 | |||
138 | |||
139 | if [ "$runlevel" = "" ] | ||
140 | then | ||
141 | niro | 1248 | rc_echo "Usage: $0 <runlevel>" >&2 |
142 | niro | 2 | exit 1 |
143 | fi | ||
144 | |||
145 | niro | 150 | |
146 | niro | 2 | previous=$PREVLEVEL |
147 | [ "$previous" = "" ] && previous=N | ||
148 | |||
149 | if [ ! -d $rc_base/rc$runlevel.d ] | ||
150 | then | ||
151 | niro | 1248 | rc_echo "$rc_base/rc$runlevel.d does not exist" |
152 | niro | 2 | exit 1 |
153 | fi | ||
154 | |||
155 | if [ "$previous" != "N" ] | ||
156 | then | ||
157 | for i in $(ls -v $rc_base/rc$runlevel.d/K* 2> /dev/null) | ||
158 | do | ||
159 | |||
160 | check_script_status | ||
161 | |||
162 | suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]} | ||
163 | prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix | ||
164 | sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix | ||
165 | |||
166 | if [ "$runlevel" != "0" ] && [ "$runlevel" != "6" ] | ||
167 | then | ||
168 | if [ ! -f $prev_start ] && [ ! -f $sysinit_start ] | ||
169 | then | ||
170 | $WARNING | ||
171 | niro | 1248 | rc_echo "$i can't be executed because it was" |
172 | rc_echo "not started in the previous runlevel ($previous)" | ||
173 | niro | 2 | $NORMAL |
174 | continue | ||
175 | fi | ||
176 | fi | ||
177 | |||
178 | $i stop | ||
179 | error_value=$? | ||
180 | |||
181 | if [ "$error_value" != "0" ] | ||
182 | then | ||
183 | print_error_msg | ||
184 | fi | ||
185 | done | ||
186 | fi | ||
187 | |||
188 | for i in $( ls -v $rc_base/rc$runlevel.d/S* 2> /dev/null) | ||
189 | do | ||
190 | if [ "$previous" != "N" ] | ||
191 | then | ||
192 | suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]} | ||
193 | stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix | ||
194 | prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix | ||
195 | |||
196 | [ -f $prev_start ] && [ ! -f $stop ] && continue | ||
197 | fi | ||
198 | |||
199 | check_script_status | ||
200 | |||
201 | $i start | ||
202 | error_value=$? | ||
203 | |||
204 | if [ "$error_value" != "0" ] | ||
205 | then | ||
206 | print_error_msg | ||
207 | fi | ||
208 | done |
Properties
Name | Value |
---|---|
svn:executable | * |