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