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