4 |
source /etc/conf.d/rc |
source /etc/conf.d/rc |
5 |
source ${rc_functions} |
source ${rc_functions} |
6 |
|
|
7 |
# load udev helper functions |
# source kernel config if exists |
8 |
source ${rc_base}/init.d/udev |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
9 |
|
|
10 |
|
# 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_DEVICEMANAGER} ]] |
13 |
|
then |
14 |
|
if [[ -e ${rc_base}/init.d/mdev ]] |
15 |
|
then |
16 |
|
RC_DEVICEMANAGER="mdev" |
17 |
|
elif [[ -e ${rc_base}/init.d/udev ]] |
18 |
|
then |
19 |
|
RC_DEVICEMANAGER="udev" |
20 |
|
fi |
21 |
|
fi |
22 |
|
|
23 |
|
# load device management hooks |
24 |
|
source ${rc_base}/init.d/${RC_DEVICEMANAGER} |
25 |
|
|
26 |
# get mage version |
# get mage version |
27 |
MAGEVER="$(< /etc/mageversion)" |
MAGEVER="$(< /etc/mageversion)" |
28 |
|
|
|
# source kernel config if exists |
|
|
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
|
|
|
|
29 |
trap "" INT QUIT TSTP |
trap "" INT QUIT TSTP |
30 |
|
|
31 |
[[ ! -z $1 ]] && runlevel=$1 |
[[ ! -z $1 ]] && runlevel=$1 |
39 |
|
|
40 |
if [[ $runlevel = sysinit ]] |
if [[ $runlevel = sysinit ]] |
41 |
then |
then |
42 |
echo |
rc_echo |
43 |
echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
44 |
echo -e "Copyright 2001-2008 Niels Rogalla; http://magellan-linux.net" |
rc_echo -e "Copyright 2001-2010 Niels Rogalla; http://magellan-linux.net" |
45 |
echo |
rc_echo |
46 |
|
|
47 |
# mount proc filesystem, needed for bootsplash; |
# mount proc filesystem, needed for bootsplash; |
48 |
# no use of '/etc/rc.d/init.d/mountproc' anymore |
# no use of '/etc/rc.d/init.d/mountproc' anymore |
49 |
if [ ! -e /proc/mounts ] |
if [ ! -e /proc/mounts ] |
50 |
then |
then |
51 |
echo -e ${COLOREDSTAR}"Mounting proc file system ..." |
rc_print "Mounting proc file system ..." |
52 |
mount -n /proc |
mount -n /proc |
53 |
evaluate_retval |
evaluate_retval |
54 |
fi |
fi |
55 |
|
|
56 |
|
# load bootsplash |
57 |
|
splash "rc_init" "${runlevel}" |
58 |
|
|
59 |
# set default verbose level for kernel messages |
# set default verbose level for kernel messages |
60 |
[ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
[ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
61 |
echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
63 |
# mount sys file system before udev |
# mount sys file system before udev |
64 |
if [ -d /sys ] |
if [ -d /sys ] |
65 |
then |
then |
66 |
echo -e ${COLOREDSTAR}"Mounting sysfs file system ..." |
rc_print "Mounting sysfs file system ..." |
67 |
mount -n -t sysfs sysfs /sys |
mount -n -t sysfs sysfs /sys |
68 |
evaluate_retval |
evaluate_retval |
69 |
else |
else |
70 |
echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
rc_echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
71 |
echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
72 |
echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
73 |
fi |
fi |
74 |
|
|
75 |
#### load udev #### |
# start device management |
76 |
start_udev |
start_devicemanager |
|
## end udev ## |
|
77 |
|
|
78 |
## load devpts ## |
## load devpts ## |
79 |
# devfs/udev with 2.6 has no ptys, so devpts is also needed |
# devfs/udev with 2.6 has no ptys, so devpts is also needed |
87 |
if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs |
if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs |
88 |
then |
then |
89 |
mkdir -p /dev/pts &> /dev/null || \ |
mkdir -p /dev/pts &> /dev/null || \ |
90 |
echo "Could not create /dev/pts !" |
rc_echo "Could not create /dev/pts !" |
91 |
fi |
fi |
92 |
|
|
93 |
# now mount devpts |
# now mount devpts |
94 |
if [ -d /dev/pts ] |
if [ -d /dev/pts ] |
95 |
then |
then |
96 |
echo -e ${COLOREDSTAR}"Mounting devpts at /dev/pts ..." |
rc_print "Mounting devpts at /dev/pts ..." |
97 |
mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
98 |
evaluate_retval |
evaluate_retval |
99 |
fi |
fi |
100 |
else |
else |
101 |
# devpts is not supported, give a warning |
# devpts is not supported, give a warning |
102 |
echo -e ${COLRED}"No devpts filesystem found ..." |
rc_echo -e ${COLRED}"No devpts filesystem found ..." |
103 |
echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." |
rc_echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." |
104 |
echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts," |
rc_echo -e ${COLYELLOW}"Devfs/Udev with a kernel-2.6.x needs devpts," |
105 |
echo -e ${COLYELLOW}"or no pty's are available." |
rc_echo -e ${COLYELLOW}"or no pty's are available." |
106 |
echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel." |
rc_echo -e ${COLYELLOW}"Please make sure that this is enabled in your kernel." |
107 |
echo |
rc_echo |
108 |
echo -e ${COLYELLOW}"Press any key to continue ..." |
rc_echo -e ${COLYELLOW}"Press any key to continue ..." |
109 |
read |
read |
110 |
fi |
fi |
111 |
## end devpts ## |
## end devpts ## |
114 |
## load usbfs ## |
## load usbfs ## |
115 |
if kernel_supports_fs usbfs |
if kernel_supports_fs usbfs |
116 |
then |
then |
117 |
echo -e ${COLOREDSTAR}"Mounting usbfs at /proc/bus/usb ..." |
rc_print "Mounting usbfs at /proc/bus/usb ..." |
118 |
mount -n -t usbfs usbfs /proc/bus/usb |
mount -n -t usbfs usbfs /proc/bus/usb |
119 |
evaluate_retval |
evaluate_retval |
120 |
fi |
fi |
121 |
## end usbfs ## |
## end usbfs ## |
122 |
|
|
123 |
## services state dir ## |
## services state dir ## |
124 |
echo -e ${COLOREDSTAR}"Mounting tmpfs at ${svcdir} ..." |
rc_print "Mounting tmpfs at ${svcdir} ..." |
125 |
mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k |
mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k |
126 |
evaluate_retval |
evaluate_retval |
|
|
|
|
# load bootsplash |
|
|
splash "rc_init" "${runlevel}" |
|
127 |
fi |
fi |
128 |
|
|
129 |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
137 |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
138 |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
139 |
then |
then |
140 |
echo -e ${COLOREDSTAR}"Saving /dev device nodes ..." |
rc_print "Saving /dev device nodes ..." |
141 |
( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
142 |
mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
143 |
evaluate_retval |
evaluate_retval |
144 |
fi |
fi |
145 |
|
|
146 |
|
# stop device management |
147 |
|
stop_devicemanager |
148 |
|
|
149 |
# run through all runlevel scripts |
# run through all runlevel scripts |
150 |
for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) |
for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) |
151 |
do |
do |
178 |
fi |
fi |
179 |
done |
done |
180 |
fi |
fi |
181 |
|
|
182 |
|
if [[ ${runlevel} = boot ]] |
183 |
|
then |
184 |
|
# exit bootsplash |
185 |
|
splash "rc_exit" "${runlevel}" |
186 |
|
fi |