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