Contents of /trunk/initscripts/busybox/rc/rc
Parent Directory | Revision Log
Revision 1774 -
(show annotations)
(download)
Sat Mar 3 16:00:17 2012 UTC (12 years, 6 months ago) by niro
File size: 4751 byte(s)
Sat Mar 3 16:00:17 2012 UTC (12 years, 6 months ago) by niro
File size: 4751 byte(s)
-support /etc/os-release file
1 | #!/bin/sh |
2 | # $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 |
5 | source ${rc_functions} |
6 | |
7 | # source kernel config if exists |
8 | [ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
9 | |
10 | # get mage version |
11 | 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 |
22 | [ -f /etc/conf.d/kernel ] && source /etc/conf.d/kernel |
23 | |
24 | # 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 | elif [[ ${RC_DEVICEMANAGER} = mdev ]] && [[ -f ${rc_base}/init.d/mdev ]] |
30 | then |
31 | source ${rc_base}/init.d/mdev |
32 | fi |
33 | |
34 | trap "" INT QUIT TSTP |
35 | |
36 | [ "$1" != "" ] && runlevel=$1 |
37 | |
38 | if [[ $runlevel = sysinit ]] |
39 | then |
40 | rc_echo |
41 | rc_echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" |
42 | rc_echo "Copyright 2001-2012 Niels Rogalla; http://magellan-linux.net" |
43 | rc_echo |
44 | |
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 | rc_print "Mounting proc file system ..." |
50 | mount -n /proc |
51 | evaluate_retval |
52 | fi |
53 | |
54 | # load bootsplash |
55 | splash "rc_init" "${runlevel}" |
56 | |
57 | # 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 | rc_print "Mounting sysfs file system ..." |
65 | mount -n -t sysfs sysfs /sys |
66 | evaluate_retval |
67 | else |
68 | 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 | fi |
72 | |
73 | # start device management |
74 | start_devicemanager |
75 | |
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 | rc_echo "Could not create /dev/pts !" |
89 | fi |
90 | |
91 | # now mount devpts |
92 | if [ -d /dev/pts ] |
93 | then |
94 | rc_print "Mounting devpts at /dev/pts ..." |
95 | 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 | 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 | read |
108 | fi |
109 | ## end devpts ## |
110 | |
111 | |
112 | ## load usbfs ## |
113 | if kernel_supports_fs usbfs |
114 | then |
115 | rc_print "Mounting usbfs at /proc/bus/usb ..." |
116 | mount -n -t usbfs usbfs /proc/bus/usb |
117 | evaluate_retval |
118 | fi |
119 | ## end usbfs ## |
120 | |
121 | ## services state dir ## |
122 | rc_print "Mounting tmpfs at ${svcdir} ..." |
123 | 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 | rc_print "Saving /dev device nodes ..." |
139 | ( 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 | # stop device management |
145 | stop_devicemanager |
146 | |
147 | # 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 | |
180 | if [[ ${runlevel} = boot ]] |
181 | then |
182 | # exit bootsplash |
183 | splash "rc_exit" "${runlevel}" |
184 | fi |