7 |
# source kernel config if exists |
# source kernel config if exists |
8 |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
9 |
|
|
10 |
# prefer mdev if it is present, always fall back to udev |
# get mage version |
11 |
# these settings can be overriden via /etc/conf.d/kernel |
if [[ -f /etc/os-release ]] |
|
if [[ -z ${RC_DEVMANAGER} ]] |
|
12 |
then |
then |
13 |
if [[ -e ${rc_base}/init.d/mdev ]] |
MAGEVER="$(read_os_release version_id)" |
14 |
then |
elif [ -f /etc/mageversion ] |
15 |
RC_DEVMANAGER="udev" |
then |
16 |
elif [[ -e ${rc_base}/init.d/udev ]] |
MAGEVER="$(< /etc/mageversion)" |
17 |
then |
else |
18 |
RC_DEVMANAGER="udev" |
MAGEVER="unkown" |
|
fi |
|
19 |
fi |
fi |
20 |
|
|
21 |
# load device management hooks |
# source kernel config if exists |
22 |
source ${rc_base}/init.d/${RC_DEVMANAGER} |
[ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
|
|
|
|
# get mage version |
|
|
MAGEVER="$(< /etc/mageversion)" |
|
|
|
|
|
trap "" INT QUIT TSTP |
|
23 |
|
|
24 |
[[ ! -z $1 ]] && runlevel=$1 |
# override devicemanager helper functions |
25 |
|
if [[ ${RC_DEVICEMANAGER} = udev ]] && [[ -f ${rc_base}/init.d/udev ]] |
26 |
|
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 |
|
# export runlevel variable to make it accessible for other rc-scripts |
38 |
|
export runlevel |
39 |
|
|
40 |
if [[ $runlevel = sysinit ]] |
if [[ $runlevel = sysinit ]] |
41 |
then |
then |
42 |
rc_echo |
rc_echo |
43 |
rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
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" |
rc_echo "Copyright 2001-2013 Niels Rogalla; http://magellan-linux.net" |
45 |
rc_echo |
rc_echo |
46 |
|
|
47 |
# mount proc filesystem, needed for bootsplash; |
# mount proc filesystem, needed for bootsplash; |
63 |
# mount sys file system before udev |
# mount sys file system before udev |
64 |
if [ -d /sys ] |
if [ -d /sys ] |
65 |
then |
then |
66 |
rc_print "Mounting sysfs file system ..." |
if [ ! -e /sys/kernel/notes ] |
67 |
mount -n -t sysfs sysfs /sys |
then |
68 |
evaluate_retval |
rc_print "Mounting sysfs file system ..." |
69 |
|
mount -n -t sysfs sysfs /sys |
70 |
|
evaluate_retval |
71 |
|
fi |
72 |
else |
else |
73 |
rc_echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." |
rc_echo -e ${COLRED}"Fatal: mountpoint /sys missing ..." |
74 |
rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
rc_echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." |
75 |
rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
rc_echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." |
76 |
fi |
fi |
77 |
|
|
78 |
# start device management |
# start device management |
79 |
start_devmanager |
start_devicemanager |
80 |
|
|
81 |
## load devpts ## |
## load devpts ## |
82 |
# 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 |
127 |
rc_print "Mounting tmpfs at ${svcdir} ..." |
rc_print "Mounting tmpfs at ${svcdir} ..." |
128 |
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 |
129 |
evaluate_retval |
evaluate_retval |
130 |
|
|
131 |
|
## /run /tmp /var/lock |
132 |
|
for i in /run /tmp /var/lock |
133 |
|
do |
134 |
|
if [ -d ${i} ] |
135 |
|
then |
136 |
|
rc_print "Mounting tmpfs at ${i} ..." |
137 |
|
mount -n -t tmpfs tmpfs ${i} -o rw,nosuid,nodev,relatime |
138 |
|
evaluate_retval |
139 |
|
fi |
140 |
|
done |
141 |
|
# extra check for /var/lock |
142 |
|
if [ -L /var/lock ] |
143 |
|
then |
144 |
|
mkdir -p /run/lock |
145 |
|
rc_print "Mounting tmpfs at /run/lock ..." |
146 |
|
mount -n -t tmpfs tmpfs /run/lock -o rw,nosuid,nodev,relatime |
147 |
|
evaluate_retval |
148 |
|
fi |
149 |
|
# extra check if /run and /var/run are directories |
150 |
|
if [ -d /run ] && [ -d /var/run ] |
151 |
|
then |
152 |
|
rc_print "Mounting tmpfs at /var/run ..." |
153 |
|
mount -n -o bind /run /var/run |
154 |
|
evaluate_retval |
155 |
|
fi |
156 |
fi |
fi |
157 |
|
|
158 |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
if [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
162 |
|
|
163 |
# if requested save devices to a device tarball before halt |
# if requested save devices to a device tarball before halt |
164 |
# only for kernels >=2.6 *and* udev |
# only for kernels >=2.6 *and* udev |
165 |
# make shure that udev is mounted but *not* devfs --> /dev/.devfsd |
# make sure that udev is mounted but *not* devfs --> /dev/.devfsd |
166 |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
if [[ ${RC_DEVICE_TARBALL} = yes ]] && \ |
167 |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
[ -e /dev/.udev -a ! -e /dev/.devfsd -a ! -e /.bootdev ] |
168 |
then |
then |
208 |
done |
done |
209 |
fi |
fi |
210 |
|
|
211 |
if [[ ${runlevel} = boot ]] |
if [[ ${runlevel} = boot ]] || [[ ${runlevel} = shutdown ]] || [[ ${runlevel} = reboot ]] |
212 |
then |
then |
213 |
# exit bootsplash |
# exit bootsplash |
214 |
splash "rc_exit" "${runlevel}" |
splash "rc_exit" "${runlevel}" |