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 |
# get mage version |
# get mage version |
11 |
MAGEVER="$(< /etc/mageversion)" |
MAGEVER="$(< /etc/mageversion)" |
13 |
# source kernel config if exists |
# source kernel config if exists |
14 |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
15 |
|
|
16 |
trap "" INT QUIT TSTP |
# override devicemanager helper functions |
17 |
|
if [[ ${RC_DEVICEMANAGER} = udev ]] && [[ -f ${rc_base}/init.d/udev ]] |
18 |
[[ ! -z $1 ]] && runlevel=$1 |
then |
19 |
|
source ${rc_base}/init.d/udev |
20 |
|
|
21 |
if [[ -z ${runlevel} ]] |
elif [[ ${RC_DEVICEMANAGER} = mdev ]] && [[ -f ${rc_base}/init.d/mdev ]] |
22 |
then |
then |
23 |
echo "Usage: $0 <runlevel>" >&2 |
source ${rc_base}/init.d/mdev |
|
exit 1 |
|
24 |
fi |
fi |
25 |
|
|
26 |
|
trap "" INT QUIT TSTP |
27 |
|
|
28 |
|
[ "$1" != "" ] && runlevel=$1 |
29 |
|
|
30 |
if [[ $runlevel = sysinit ]] |
if [[ $runlevel = sysinit ]] |
31 |
then |
then |
32 |
echo |
rc_echo |
33 |
echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
34 |
echo -e "Copyright 2001-2010 Niels Rogalla; http://magellan-linux.net" |
rc_echo "Copyright 2001-2011 Niels Rogalla; http://magellan-linux.net" |
35 |
echo |
rc_echo |
36 |
|
|
37 |
# mount proc filesystem, needed for bootsplash; |
# mount proc filesystem, needed for bootsplash; |
38 |
# no use of '/etc/rc.d/init.d/mountproc' anymore |
# no use of '/etc/rc.d/init.d/mountproc' anymore |
39 |
if [ ! -e /proc/mounts ] |
if [ ! -e /proc/mounts ] |
40 |
then |
then |
41 |
echo -e ${COLOREDSTAR}"Mounting proc file system ..." |
rc_print "Mounting proc file system ..." |
42 |
mount -n /proc |
mount -n /proc |
43 |
evaluate_retval |
evaluate_retval |
44 |
fi |
fi |
45 |
|
|
46 |
|
# load bootsplash |
47 |
|
splash "rc_init" "${runlevel}" |
48 |
|
|
49 |
# set default verbose level for kernel messages |
# set default verbose level for kernel messages |
50 |
[ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
[ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 |
51 |
echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk |
53 |
# mount sys file system before udev |
# mount sys file system before udev |
54 |
if [ -d /sys ] |
if [ -d /sys ] |
55 |
then |
then |
56 |
echo -e ${COLOREDSTAR}"Mounting sysfs file system ..." |
rc_print "Mounting sysfs file system ..." |
57 |
mount -n -t sysfs sysfs /sys |
mount -n -t sysfs sysfs /sys |
58 |
evaluate_retval |
evaluate_retval |
59 |
else |
else |
60 |
echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
rc_echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
61 |
echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
62 |
echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
63 |
fi |
fi |
64 |
|
|
65 |
#### load udev #### |
# start device management |
66 |
start_udev |
start_devicemanager |
|
## end udev ## |
|
67 |
|
|
68 |
## load devpts ## |
## load devpts ## |
69 |
# 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 |
77 |
if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs |
if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs |
78 |
then |
then |
79 |
mkdir -p /dev/pts &> /dev/null || \ |
mkdir -p /dev/pts &> /dev/null || \ |
80 |
echo "Could not create /dev/pts !" |
rc_echo "Could not create /dev/pts !" |
81 |
fi |
fi |
82 |
|
|
83 |
# now mount devpts |
# now mount devpts |
84 |
if [ -d /dev/pts ] |
if [ -d /dev/pts ] |
85 |
then |
then |
86 |
echo -e ${COLOREDSTAR}"Mounting devpts at /dev/pts ..." |
rc_print "Mounting devpts at /dev/pts ..." |
87 |
mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts |
88 |
evaluate_retval |
evaluate_retval |
89 |
fi |
fi |
90 |
else |
else |
91 |
# devpts is not supported, give a warning |
# devpts is not supported, give a warning |
92 |
echo -e ${COLRED}"No devpts filesystem found ..." |
rc_echo -e ${COLRED}"No devpts filesystem found ..." |
93 |
echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." |
rc_echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." |
94 |
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," |
95 |
echo -e ${COLYELLOW}"or no pty's are available." |
rc_echo -e ${COLYELLOW}"or no pty's are available." |
96 |
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." |
97 |
echo |
rc_echo |
98 |
echo -e ${COLYELLOW}"Press any key to continue ..." |
rc_echo -e ${COLYELLOW}"Press any key to continue ..." |
99 |
read |
read |
100 |
fi |
fi |
101 |
## end devpts ## |
## end devpts ## |
104 |
## load usbfs ## |
## load usbfs ## |
105 |
if kernel_supports_fs usbfs |
if kernel_supports_fs usbfs |
106 |
then |
then |
107 |
echo -e ${COLOREDSTAR}"Mounting usbfs at /proc/bus/usb ..." |
rc_print "Mounting usbfs at /proc/bus/usb ..." |
108 |
mount -n -t usbfs usbfs /proc/bus/usb |
mount -n -t usbfs usbfs /proc/bus/usb |
109 |
evaluate_retval |
evaluate_retval |
110 |
fi |
fi |
111 |
## end usbfs ## |
## end usbfs ## |
112 |
|
|
113 |
## services state dir ## |
## services state dir ## |
114 |
echo -e ${COLOREDSTAR}"Mounting tmpfs at ${svcdir} ..." |
rc_print "Mounting tmpfs at ${svcdir} ..." |
115 |
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 |
116 |
evaluate_retval |
evaluate_retval |
|
|
|
|
# load bootsplash |
|
|
splash "rc_init" "${runlevel}" |
|
117 |
fi |
fi |
118 |
|
|
119 |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
127 |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
128 |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
129 |
then |
then |
130 |
echo -e ${COLOREDSTAR}"Saving /dev device nodes ..." |
rc_print "Saving /dev device nodes ..." |
131 |
( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
( cd /dev; tar -jclpf "/tmp/devices-$$.tar.bz2" * &> /dev/null ) |
132 |
mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
mv -f "/tmp/devices-$$.tar.bz2" /lib/udev/state/devices.tar.bz2 |
133 |
evaluate_retval |
evaluate_retval |
134 |
fi |
fi |
135 |
|
|
136 |
|
# stop device management |
137 |
|
stop_devicemanager |
138 |
|
|
139 |
# run through all runlevel scripts |
# run through all runlevel scripts |
140 |
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) |
141 |
do |
do |
168 |
fi |
fi |
169 |
done |
done |
170 |
fi |
fi |
171 |
|
|
172 |
|
if [[ ${runlevel} = boot ]] |
173 |
|
then |
174 |
|
# exit bootsplash |
175 |
|
splash "rc_exit" "${runlevel}" |
176 |
|
fi |