Contents of /tags/busybox-init-0_1_12/rc/rc
Parent Directory | Revision Log
Revision 1168 -
(show annotations)
(download)
Wed Dec 15 17:44:36 2010 UTC (13 years, 9 months ago) by niro
Original Path: trunk/busybox-initscripts/rc/rc
File size: 4384 byte(s)
Wed Dec 15 17:44:36 2010 UTC (13 years, 9 months ago) by niro
Original Path: trunk/busybox-initscripts/rc/rc
File size: 4384 byte(s)
-added rc_print() and rc_echo() functions and replaced all corresponding echos with them -added bootsplash support and initialize splash -mount.rc: record mdev as mounted - equivalent to udev -mount.rc: added devtmpfs to NO_FS -rc-config: added mdev to RC_EXCLUDE -removed udev.rc, should be installed with udev itself
1 | #!/bin/sh |
2 | # $Header: /home/cvsd/magellan-cvs/magellan-src/busybox-initscripts/rc/rc,v 1.2 2008-12-22 22:09:27 niro Exp $ |
3 | |
4 | source /etc/conf.d/rc |
5 | source ${rc_functions} |
6 | |
7 | # load udev helper functions |
8 | source ${rc_base}/init.d/udev |
9 | |
10 | # get mage version |
11 | MAGEVER="$(< /etc/mageversion)" |
12 | |
13 | # source kernel config if exists |
14 | [ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
15 | |
16 | trap "" INT QUIT TSTP |
17 | |
18 | [[ ! -z $1 ]] && runlevel=$1 |
19 | |
20 | if [[ -z ${runlevel} ]] |
21 | then |
22 | echo "Usage: $0 <runlevel>" >&2 |
23 | exit 1 |
24 | fi |
25 | |
26 | |
27 | if [[ $runlevel = sysinit ]] |
28 | then |
29 | rc_echo |
30 | rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
31 | rc_echo -e "Copyright 2001-2010 Niels Rogalla; http://magellan-linux.net" |
32 | rc_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 | rc_print "Mounting proc file system ..." |
39 | mount -n /proc |
40 | evaluate_retval |
41 | fi |
42 | |
43 | # load bootsplash |
44 | splash "rc_init" "${runlevel}" |
45 | |
46 | # set default verbose level for kernel messages |
47 | [ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
48 | echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
49 | |
50 | # mount sys file system before udev |
51 | if [ -d /sys ] |
52 | then |
53 | rc_print "Mounting sysfs file system ..." |
54 | mount -n -t sysfs sysfs /sys |
55 | evaluate_retval |
56 | else |
57 | rc_echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
58 | rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
59 | rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
60 | fi |
61 | |
62 | #### load udev #### |
63 | start_udev |
64 | ## end udev ## |
65 | |
66 | ## load devpts ## |
67 | # devfs/udev with 2.6 has no ptys, so devpts is also needed |
68 | # check if we really have devpts support |
69 | if kernel_supports_fs devpts |
70 | then |
71 | # /dev/pts maybe not exists. |
72 | # We only create this directory only if devfs was mounted, |
73 | # or it will fail as / is still mounted readonly |
74 | # udev has this dir already, only a sanity check for devfs |
75 | if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs |
76 | then |
77 | mkdir -p /dev/pts &> /dev/null || \ |
78 | rc_echo "Could not create /dev/pts !" |
79 | fi |
80 | |
81 | # now mount devpts |
82 | if [ -d /dev/pts ] |
83 | then |
84 | rc_print "Mounting devpts at /dev/pts ..." |
85 | mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
86 | evaluate_retval |
87 | fi |
88 | else |
89 | # devpts is not supported, give a warning |
90 | rc_echo -e ${COLRED}"No devpts filesystem found ..." |
91 | rc_echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." |
92 | rc_echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts," |
93 | rc_echo -e ${COLYELLOW}"or no pty's are available." |
94 | rc_echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel." |
95 | rc_echo |
96 | rc_echo -e ${COLYELLOW}"Press any key to continue ..." |
97 | read |
98 | fi |
99 | ## end devpts ## |
100 | |
101 | |
102 | ## load usbfs ## |
103 | if kernel_supports_fs usbfs |
104 | then |
105 | rc_print "Mounting usbfs at /proc/bus/usb ..." |
106 | mount -n -t usbfs usbfs /proc/bus/usb |
107 | evaluate_retval |
108 | fi |
109 | ## end usbfs ## |
110 | |
111 | ## services state dir ## |
112 | rc_print "Mounting tmpfs at ${svcdir} ..." |
113 | mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k |
114 | evaluate_retval |
115 | fi |
116 | |
117 | if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
118 | then |
119 | # load bootsplash |
120 | 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 | if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
126 | [ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
127 | then |
128 | rc_print "Saving /dev device nodes ..." |
129 | ( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
130 | mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
131 | evaluate_retval |
132 | fi |
133 | |
134 | # stop udev now |
135 | stop_udev |
136 | |
137 | # run through all runlevel scripts |
138 | for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) |
139 | do |
140 | check_script_status |
141 | suffix=${i#${rc_base}/rc${runlevel}.d/K[0-9][0-9]} |
142 | |
143 | ${i} stop |
144 | error_value=$? |
145 | |
146 | if [[ ${error_value} != 0 ]] |
147 | then |
148 | print_error_msg |
149 | fi |
150 | done |
151 | fi |
152 | |
153 | if [[ ${runlevel} = sysinit ]] || [[ ${runlevel} = boot ]] |
154 | then |
155 | for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null) |
156 | do |
157 | suffix=${i#${rc_base}/rc${runlevel}.d/S[0-9][0-9]} |
158 | check_script_status |
159 | |
160 | ${i} start |
161 | error_value=$? |
162 | |
163 | if [[ ${error_value} != 0 ]] |
164 | then |
165 | print_error_msg |
166 | fi |
167 | done |
168 | fi |
169 | |
170 | if [[ ${runlevel} = boot ]] |
171 | then |
172 | # exit bootsplash |
173 | splash "rc_exit" "${runlevel}" |
174 | fi |