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