Magellan Linux

Annotation of /trunk/initscripts/busybox/rc/rc

Parent Directory Parent Directory | Revision Log Revision Log


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