1 | #!/bin/bash |
---|
2 | # |
---|
3 | # /etc/rc.sysinit - run once at boot time |
---|
4 | # |
---|
5 | # Taken in part from Miquel van Smoorenburg's bcheckrc. |
---|
6 | # |
---|
7 | |
---|
8 | # Set the path |
---|
9 | PATH=/bin:/sbin:/usr/bin:/usr/sbin |
---|
10 | export PATH |
---|
11 | |
---|
12 | HOSTNAME=`/bin/hostname` |
---|
13 | HOSTTYPE=`uname -m` |
---|
14 | KERNELRELEASE=`uname -r` |
---|
15 | KERNELVERSION=`echo $KERNELRELEASE | cut -f 1-2 -d.` |
---|
16 | |
---|
17 | # VLEE: make host dependent /etc |
---|
18 | if [ -x /etc/rc.diskless ]; then |
---|
19 | echo -n "Preparing diskless setup :" |
---|
20 | if /etc/rc.diskless ; then |
---|
21 | echo " [ OK ]" |
---|
22 | else |
---|
23 | echo " [ NG ]" |
---|
24 | fi |
---|
25 | elif [ -x /DLKit/etc/rc.diskless ]; then |
---|
26 | echo -n "Preparing diskless setup :" |
---|
27 | if /DLKit/etc/rc.diskless ; then |
---|
28 | echo " [ OK ]" |
---|
29 | else |
---|
30 | echo " [ NG ]" |
---|
31 | fi |
---|
32 | fi |
---|
33 | |
---|
34 | # Read in config data. |
---|
35 | if [ -f /etc/sysconfig/network ]; then |
---|
36 | . /etc/sysconfig/network |
---|
37 | else |
---|
38 | NETWORKING=no |
---|
39 | fi |
---|
40 | |
---|
41 | if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then |
---|
42 | HOSTNAME=localhost |
---|
43 | fi |
---|
44 | |
---|
45 | # Mount /proc, /sys |
---|
46 | if [ ! -e /proc/mounts ]; then |
---|
47 | mount -n -t proc /proc /proc |
---|
48 | mount -n -t sysfs /sys /sys >/dev/null 2>&1 |
---|
49 | fi |
---|
50 | if [ ! -d /proc/bus/usb ]; then |
---|
51 | modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb |
---|
52 | else |
---|
53 | mount -n -t usbfs /proc/bus/usb /proc/bus/usb |
---|
54 | fi |
---|
55 | |
---|
56 | # readahead |
---|
57 | if [ -f /.readahead_collect -a -r /etc/sysconfig/readahead ]; then |
---|
58 | . /etc/sysconfig/readahead |
---|
59 | if [ "x$READAHEAD_COLLECT" == "xyes" -a ! -f /forcefsck -a -x /sbin/readahead-collector ]; then |
---|
60 | /sbin/readahead-collector |
---|
61 | fi |
---|
62 | elif [ -x /sbin/readahead_early ]; then |
---|
63 | /sbin/readahead_early & |
---|
64 | fi |
---|
65 | |
---|
66 | if [ -x /etc/rc.early.local ]; then |
---|
67 | . /etc/rc.early.local |
---|
68 | fi |
---|
69 | |
---|
70 | # Source functions |
---|
71 | . /etc/init.d/functions |
---|
72 | |
---|
73 | PLYMOUTH= |
---|
74 | [ -x /usr/bin/plymouth ] && PLYMOUTH=yes |
---|
75 | |
---|
76 | # Print a banner. ;) |
---|
77 | echo -en $"\t\t\tWelcome to " |
---|
78 | [ "$BOOTUP" != "serial" ] && echo -en $"\\033[1;36m" |
---|
79 | echo -en $"Vine" |
---|
80 | [ "$BOOTUP" != "serial" ] && echo -en $"\\033[0;39m" |
---|
81 | echo $" Linux" |
---|
82 | if [ "$PROMPT" != "no" ]; then |
---|
83 | echo -en $"\t\tPress 'I' to enter interactive startup." |
---|
84 | echo |
---|
85 | fi |
---|
86 | |
---|
87 | # Fix console loglevel |
---|
88 | /bin/dmesg -n $LOGLEVEL |
---|
89 | |
---|
90 | # read /proc/cmdline once |
---|
91 | cmdline=$(cat /proc/cmdline) |
---|
92 | |
---|
93 | # Initialize hardware |
---|
94 | if [ -f /proc/sys/kernel/modprobe ]; then |
---|
95 | if ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; then |
---|
96 | sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1 |
---|
97 | else |
---|
98 | sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1 |
---|
99 | fi |
---|
100 | fi |
---|
101 | |
---|
102 | touch /dev/.in_sysinit >/dev/null 2>&1 |
---|
103 | |
---|
104 | # kill nash and start udev |
---|
105 | nashpid=$(pidof nash 2>/dev/null) |
---|
106 | [ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1 |
---|
107 | unset nashpid |
---|
108 | /sbin/start_udev |
---|
109 | |
---|
110 | # Load user-defined modules |
---|
111 | for file in /etc/sysconfig/modules/*.modules ; do |
---|
112 | [ -x $file ] && $file |
---|
113 | done |
---|
114 | |
---|
115 | # Load modules (for backward compatibility with VARs) |
---|
116 | if [ -f /etc/rc.modules ]; then |
---|
117 | /etc/rc.modules |
---|
118 | fi |
---|
119 | |
---|
120 | # VLEE: make and mount /dev |
---|
121 | if [ -x /etc/rc.MAKEDEV ]; then |
---|
122 | action $"Making and Mounting /dev filesystem: " /etc/rc.MAKEDEV |
---|
123 | elif [ -x /DLKit/etc/rc.MAKEDEV ]; then |
---|
124 | action $"Making and Mounting /dev filesystem: " /DLKit/etc/rc.MAKEDEV |
---|
125 | fi |
---|
126 | |
---|
127 | # Unmount the initrd, if necessary |
---|
128 | if grep -q /initrd /proc/mounts && ! grep -q /initrd/loopfs /proc/mounts ; then |
---|
129 | action $"Unmounting initrd: " umount /initrd |
---|
130 | /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1 |
---|
131 | fi |
---|
132 | |
---|
133 | # load SCSI modules |
---|
134 | for module in `/sbin/modprobe -c | LC_ALL=C awk '/^alias[[:space:]]+scsi_hostadapter[0-9]*[[:space:]]/ { print $3 }'` |
---|
135 | do |
---|
136 | if ( modprobe --dry-run $module 2> /dev/null ) ; then |
---|
137 | action $"Loading SCSI module ($module): " /sbin/modprobe $module |
---|
138 | fi |
---|
139 | done |
---|
140 | |
---|
141 | # Configure kernel parameters |
---|
142 | update_boot_stage RCkernelparam |
---|
143 | action $"Configuring kernel parameters: " sysctl -e -p /etc/sysctl.conf |
---|
144 | |
---|
145 | # Set the system clock. |
---|
146 | ARC=0 |
---|
147 | SRM=0 |
---|
148 | UTC=0 |
---|
149 | |
---|
150 | if [ -f /etc/sysconfig/clock ]; then |
---|
151 | . /etc/sysconfig/clock |
---|
152 | |
---|
153 | # convert old style clock config to new values |
---|
154 | if [ "${CLOCKMODE}" = "GMT" ]; then |
---|
155 | UTC=true |
---|
156 | elif [ "${CLOCKMODE}" = "ARC" ]; then |
---|
157 | ARC=true |
---|
158 | fi |
---|
159 | fi |
---|
160 | |
---|
161 | CLOCKDEF="" |
---|
162 | CLOCKFLAGS="$CLOCKFLAGS --hctosys" |
---|
163 | |
---|
164 | case "$UTC" in |
---|
165 | yes|true) |
---|
166 | CLOCKFLAGS="$CLOCKFLAGS --utc"; |
---|
167 | CLOCKDEF="$CLOCKDEF (utc)"; |
---|
168 | ;; |
---|
169 | no|false) |
---|
170 | CLOCKFLAGS="$CLOCKFLAGS --localtime"; |
---|
171 | CLOCKDEF="$CLOCKDEF (localtime)"; |
---|
172 | ;; |
---|
173 | esac |
---|
174 | |
---|
175 | case "$ARC" in |
---|
176 | yes|true) |
---|
177 | CLOCKFLAGS="$CLOCKFLAGS --arc"; |
---|
178 | CLOCKDEF="$CLOCKDEF (arc)"; |
---|
179 | ;; |
---|
180 | esac |
---|
181 | case "$SRM" in |
---|
182 | yes|true) |
---|
183 | CLOCKFLAGS="$CLOCKFLAGS --srm"; |
---|
184 | CLOCKDEF="$CLOCKDEF (srm)"; |
---|
185 | ;; |
---|
186 | esac |
---|
187 | |
---|
188 | /sbin/hwclock $CLOCKFLAGS |
---|
189 | |
---|
190 | action $"Setting clock $CLOCKDEF: `date`" date |
---|
191 | |
---|
192 | if [ "`/sbin/consoletype`" = "vt" ]; then |
---|
193 | # Load keymap |
---|
194 | if [ -x /bin/loadkeys ]; then |
---|
195 | KEYTABLE= |
---|
196 | KEYMAP= |
---|
197 | if [ -f /etc/sysconfig/console/default.kmap ]; then |
---|
198 | KEYMAP=/etc/sysconfig/console/default.kmap |
---|
199 | else |
---|
200 | if [ -f /etc/sysconfig/keyboard ]; then |
---|
201 | . /etc/sysconfig/keyboard |
---|
202 | fi |
---|
203 | if [ -n "$KEYTABLE" -a -d "/lib/kbd/keymaps" ]; then |
---|
204 | KEYMAP=$KEYTABLE |
---|
205 | fi |
---|
206 | fi |
---|
207 | if [ -n "$KEYMAP" ]; then |
---|
208 | # Since this takes in/output from stdin/out, we can't use initlog |
---|
209 | if [ -n "$KEYTABLE" ]; then |
---|
210 | echo -n $"Loading default keymap ($KEYTABLE): " |
---|
211 | else |
---|
212 | echo -n $"Loading default keymap: " |
---|
213 | fi |
---|
214 | loadkeys $KEYMAP < /dev/tty0 > /dev/tty0 2>/dev/null && \ |
---|
215 | success $"Loading default keymap" || failure $"Loading default keymap" |
---|
216 | echo |
---|
217 | fi |
---|
218 | fi |
---|
219 | fi |
---|
220 | |
---|
221 | # Start up swapping. |
---|
222 | action $"Activating swap partitions: " swapon -a -e |
---|
223 | |
---|
224 | # Set the hostname. |
---|
225 | update_boot_stage RChostname |
---|
226 | action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME} |
---|
227 | |
---|
228 | # Sync waiting for storage. |
---|
229 | { rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1 |
---|
230 | |
---|
231 | # Device mapper & related initialization |
---|
232 | if ! grep -q -F "device-mapper" /proc/devices >/dev/null 2>&1 ; then |
---|
233 | modprobe dm-mod >/dev/null 2>&1 |
---|
234 | fi |
---|
235 | |
---|
236 | [ -f /etc/mdadm.conf -a -x /sbin/mdadm ] && /sbin/mdadm -As --auto=yes --run |
---|
237 | |
---|
238 | if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then |
---|
239 | modprobe dm-multipath >/dev/null 2>&1 |
---|
240 | /sbin/multipath -v 0 |
---|
241 | if [ -x /sbin/kpartx ]; then |
---|
242 | /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a" |
---|
243 | fi |
---|
244 | fi |
---|
245 | |
---|
246 | if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid.static ]; then |
---|
247 | modprobe dm-mirror > /dev/null 2>&1 |
---|
248 | dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i) |
---|
249 | if [ "$?" = "0" ]; then |
---|
250 | for dmname in $dmraidsets; do |
---|
251 | if [[ "$dmname" == isw_* ]] && \ |
---|
252 | ! strstr "$cmdline" noiswmd; then |
---|
253 | continue |
---|
254 | fi |
---|
255 | /sbin/dmraid.static -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1 |
---|
256 | /sbin/kpartx -a -p p "/dev/mapper/$dmname" |
---|
257 | done |
---|
258 | fi |
---|
259 | fi |
---|
260 | |
---|
261 | # Start any MD RAID arrays that haven't been started yet |
---|
262 | [ -r /proc/mdstat ] && [ -r /dev/md/md-device-map ] && /sbin/mdadm -IRs |
---|
263 | |
---|
264 | if [ -x /sbin/lvm ]; then |
---|
265 | action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit |
---|
266 | fi |
---|
267 | |
---|
268 | update_boot_stage RCfsck |
---|
269 | |
---|
270 | if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then |
---|
271 | fastboot=yes |
---|
272 | else |
---|
273 | fastboot= |
---|
274 | fi |
---|
275 | |
---|
276 | if [ -f /fsckoptions ]; then |
---|
277 | fsckoptions=`cat /fsckoptions` |
---|
278 | else |
---|
279 | fsckoptions= |
---|
280 | fi |
---|
281 | |
---|
282 | READONLY= |
---|
283 | if [ -f /etc/sysconfig/readonly-root ]; then |
---|
284 | . /etc/sysconfig/readonly-root |
---|
285 | fi |
---|
286 | if strstr "$cmdline" readonlyroot ; then |
---|
287 | READONLY=yes |
---|
288 | fi |
---|
289 | if strstr "$cmdline" noreadonlyroot ; then |
---|
290 | READONLY=no |
---|
291 | fi |
---|
292 | |
---|
293 | |
---|
294 | if [ -f /forcefsck ]; then |
---|
295 | fsckoptions="-f $fsckoptions" |
---|
296 | elif [ -f /.autofsck ]; then |
---|
297 | echo $"Your system appears to have shut down uncleanly" |
---|
298 | AUTOFSCK_TIMEOUT=5 |
---|
299 | AUTOFSCK_DEF_CHECK=no |
---|
300 | [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck |
---|
301 | if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then |
---|
302 | AUTOFSCK_OPT=-f |
---|
303 | else |
---|
304 | AUTOFSCK_OPT= |
---|
305 | fi |
---|
306 | |
---|
307 | if [ "$PROMPT" != "no" ]; then |
---|
308 | if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then |
---|
309 | if /sbin/getkey -c $AUTOFSCK_TIMEOUT -m $"Press N within %d seconds to not force file system integrity check..." n ; then |
---|
310 | AUTOFSCK_OPT= |
---|
311 | fi |
---|
312 | else |
---|
313 | if /sbin/getkey -c $AUTOFSCK_TIMEOUT -m $"Press Y within %d seconds to force file system integrity check..." y ; then |
---|
314 | AUTOFSCK_OPT=-f |
---|
315 | fi |
---|
316 | fi |
---|
317 | echo |
---|
318 | else |
---|
319 | # PROMPT not allowed |
---|
320 | if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then |
---|
321 | echo $"Forcing file system integrity check due to default setting" |
---|
322 | else |
---|
323 | echo $"Not forcing file system integrity check due to default setting" |
---|
324 | fi |
---|
325 | fi |
---|
326 | fsckoptions="$AUTOFSCK_OPT $fsckoptions" |
---|
327 | fi |
---|
328 | |
---|
329 | if [ "$BOOTUP" != "serial" ]; then |
---|
330 | fsckoptions="-C $fsckoptions" |
---|
331 | else |
---|
332 | fsckoptions="-V $fsckoptions" |
---|
333 | fi |
---|
334 | |
---|
335 | _RUN_QUOTACHECK=0 |
---|
336 | ROOTFSTYPE=`grep " / " /proc/mounts | awk '{ print $3 }'` |
---|
337 | if [ -z "$fastboot" -a "$READONLY" != "yes" -a "$ROOTFSTYPE" != "nfs" -a "$ROOTFSTYPE" != "reiserfs" -a "$ROOTFSTYPE" != "unionfs" -a "$ROOTFSTYPE" != "squashfs" ]; then |
---|
338 | |
---|
339 | STRING=$"Checking root filesystem" |
---|
340 | echo $STRING |
---|
341 | fsck -T -a $fsckoptions / |
---|
342 | rc=$? |
---|
343 | |
---|
344 | if [ "$rc" = "0" ]; then |
---|
345 | success "$STRING" |
---|
346 | echo |
---|
347 | elif [ "$rc" = "1" ]; then |
---|
348 | passed $"$STRING" |
---|
349 | echo |
---|
350 | fi |
---|
351 | |
---|
352 | # A return of 2 or higher means there were serious problems. |
---|
353 | if [ $rc -gt 1 ]; then |
---|
354 | [ -n "$PLYMOUTH" ] && plymouth --hide-splash |
---|
355 | |
---|
356 | failure "$STRING" |
---|
357 | echo |
---|
358 | echo |
---|
359 | echo $"*** An error occurred during the file system check." |
---|
360 | echo $"*** Dropping you to a shell; the system will reboot" |
---|
361 | echo $"*** when you leave the shell." |
---|
362 | |
---|
363 | PS1=$"(Repair filesystem) \# # "; export PS1 |
---|
364 | sulogin |
---|
365 | |
---|
366 | echo $"Unmounting file systems" |
---|
367 | umount -a |
---|
368 | mount -n -o remount,ro / |
---|
369 | echo $"Automatic reboot in progress." |
---|
370 | reboot -f |
---|
371 | elif [ "$rc" = "1" ]; then |
---|
372 | _RUN_QUOTACHECK=1 |
---|
373 | fi |
---|
374 | fi |
---|
375 | |
---|
376 | update_boot_stage RCquotacheck |
---|
377 | |
---|
378 | # Possibly update quotas if fsck was run on /. |
---|
379 | grep -E '[[:space:]]+/[[:space:]]+' /etc/fstab | \ |
---|
380 | awk '{ print $4 }' | \ |
---|
381 | grep -q quota |
---|
382 | _ROOT_HAS_QUOTA=$? |
---|
383 | if [ X"$_RUN_QUOTACHECK" = X1 -a \ |
---|
384 | "$_ROOT_HAS_QUOTA" -a \ |
---|
385 | -x /sbin/quotacheck ]; then |
---|
386 | if [ -x /sbin/convertquota ]; then |
---|
387 | if [ -f /quota.user ]; then |
---|
388 | action $"Converting old user quota files: " \ |
---|
389 | /sbin/convertquota -u / && rm -f /quota.user |
---|
390 | fi |
---|
391 | if [ -f /quota.group ]; then |
---|
392 | action $"Converting old group quota files: " \ |
---|
393 | /sbin/convertquota -g / && rm -f /quota.group |
---|
394 | fi |
---|
395 | fi |
---|
396 | action $"Checking root filesystem quotas: " /sbin/quotacheck -nug / |
---|
397 | fi |
---|
398 | |
---|
399 | # check for arguments passed from kernel |
---|
400 | |
---|
401 | update_boot_stage RCmountfs |
---|
402 | |
---|
403 | # Remount the root filesystem in specified mode |
---|
404 | state=`awk '/(^\/dev\/root| \/ )/ { print $4 }' /proc/mounts` |
---|
405 | newstate=`awk '/^#/{next} $2 == "/" {print $4 }' /etc/fstab` |
---|
406 | if strstr "$cmdline" no_remount_rootfs ;then |
---|
407 | action $"Staying readonly root filesystem mode : " /bin/true |
---|
408 | else |
---|
409 | [ "$state" != "rw" ] && \ |
---|
410 | action $"Remounting root filesystem in specified mode($newstate): " mount -n -o remount,$newstate / |
---|
411 | fi |
---|
412 | |
---|
413 | if [ "$READONLY" != "yes" ]; then |
---|
414 | # Clear mtab |
---|
415 | (>/etc/mtab) &> /dev/null |
---|
416 | |
---|
417 | # Remove stale backups |
---|
418 | rm -f /etc/mtab~ /etc/mtab~~ |
---|
419 | |
---|
420 | # Enter root, /proc and (potentially) /proc/bus/usb and devfs into mtab. |
---|
421 | mount -f / |
---|
422 | mount -f /proc >/dev/null 2>&1 |
---|
423 | mount -f /sys >/dev/null 2>&1 |
---|
424 | mount -f /dev/pts >/dev/null 2>&1 |
---|
425 | mount -f /dev/shm >/dev/null 2>&1 |
---|
426 | mount -f /proc/bus/usb >/dev/null 2>&1 |
---|
427 | fi |
---|
428 | |
---|
429 | if strstr "$cmdline" hdparm ;then |
---|
430 | update_boot_stage RChdparm |
---|
431 | |
---|
432 | # Turn on harddisk optimization |
---|
433 | # There is only one file /etc/sysconfig/harddisks for all disks |
---|
434 | # after installing the hdparm-RPM. If you need different hdparm parameters |
---|
435 | # for each of your disks, copy /etc/sysconfig/harddisks to |
---|
436 | # /etc/sysconfig/harddiskhda (hdb, hdc...) and modify it. |
---|
437 | # each disk which has no special parameters will use the defaults. |
---|
438 | |
---|
439 | disk[0]=s; disk[1]=hda; disk[2]=hdb; disk[3]=hdc; |
---|
440 | disk[4]=hdd; disk[5]=hde; disk[6]=hdf; disk[7]=hdg; disk[8]=hdh; |
---|
441 | |
---|
442 | |
---|
443 | if [ -x /sbin/hdparm ]; then |
---|
444 | for device in 0 1 2 3 4 5 6 7 8; do |
---|
445 | unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS |
---|
446 | if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then |
---|
447 | . /etc/sysconfig/harddisk${disk[$device]} |
---|
448 | HDFLAGS[$device]= |
---|
449 | if [ -n "$MULTIPLE_IO" ]; then |
---|
450 | HDFLAGS[$device]="-q -m$MULTIPLE_IO" |
---|
451 | fi |
---|
452 | if [ -n "$USE_DMA" ]; then |
---|
453 | HDFLAGS[$device]="${HDFLAGS[$device]} -q -d$USE_DMA" |
---|
454 | fi |
---|
455 | if [ -n "$EIDE_32BIT" ]; then |
---|
456 | HDFLAGS[$device]="${HDFLAGS[$device]} -q -c$EIDE_32BIT" |
---|
457 | fi |
---|
458 | if [ -n "$LOOKAHEAD" ]; then |
---|
459 | HDFLAGS[$device]="${HDFLAGS[$device]} -q -A$LOOKAHEAD" |
---|
460 | fi |
---|
461 | if [ -n "$EXTRA_PARAMS" ]; then |
---|
462 | HDFLAGS[$device]="${HDFLAGS[$device]} $EXTRA_PARAMS" |
---|
463 | fi |
---|
464 | else |
---|
465 | HDFLAGS[$device]="${HDFLAGS[0]}" |
---|
466 | fi |
---|
467 | if [ -e "/proc/ide/${disk[$device]}/media" ] ; then |
---|
468 | hdmedia=`cat /proc/ide/${disk[$device]}/media` |
---|
469 | if [ "$hdmedia" = "disk" ]; then |
---|
470 | if [ -n "${HDFLAGS[$device]}" ]; then |
---|
471 | action $"Setting hard drive parameters for ${disk[$device]}: " /sbin/hdparm ${HDFLAGS[$device]} /dev/${disk[$device]} |
---|
472 | fi |
---|
473 | fi |
---|
474 | fi |
---|
475 | done |
---|
476 | fi |
---|
477 | fi |
---|
478 | |
---|
479 | # The root filesystem is now read-write, so we can now log via syslog() directly.. |
---|
480 | if [ -n "$IN_INITLOG" ]; then |
---|
481 | IN_INITLOG= |
---|
482 | fi |
---|
483 | |
---|
484 | update_boot_stage RCfsck |
---|
485 | |
---|
486 | _RUN_QUOTACHECK=0 |
---|
487 | # Check filesystems |
---|
488 | if [ -z "$fastboot" ]; then |
---|
489 | STRING=$"Checking filesystems" |
---|
490 | echo $STRING |
---|
491 | fsck -T -R -A -a $fsckoptions |
---|
492 | rc=$? |
---|
493 | if [ "$rc" = "0" ]; then |
---|
494 | success "$STRING" |
---|
495 | echo |
---|
496 | elif [ "$rc" = "1" ]; then |
---|
497 | passed "$STRING" |
---|
498 | echo |
---|
499 | fi |
---|
500 | |
---|
501 | # A return of 2 or higher means there were serious problems. |
---|
502 | if [ $rc -gt 1 ]; then |
---|
503 | failure "$STRING" |
---|
504 | echo |
---|
505 | echo |
---|
506 | echo $"*** An error occurred during the file system check." |
---|
507 | echo $"*** Dropping you to a shell; the system will reboot" |
---|
508 | echo $"*** when you leave the shell." |
---|
509 | |
---|
510 | PS1=$"(Repair filesystem) \# # "; export PS1 |
---|
511 | sulogin |
---|
512 | |
---|
513 | echo $"Unmounting file systems" |
---|
514 | umount -a |
---|
515 | mount -n -o remount,ro / |
---|
516 | echo $"Automatic reboot in progress." |
---|
517 | reboot -f |
---|
518 | elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then |
---|
519 | _RUN_QUOTACHECK=1 |
---|
520 | fi |
---|
521 | fi |
---|
522 | |
---|
523 | update_boot_stage RClocalfs |
---|
524 | |
---|
525 | # Mount all other filesystems (except for NFS and /proc, which is already |
---|
526 | # mounted). Contrary to standard usage, |
---|
527 | # filesystems are NOT unmounted in single user mode. |
---|
528 | if [ "$READONLY" != "yes" ] ; then |
---|
529 | action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev >/dev/null 2>&1 |
---|
530 | else |
---|
531 | action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev >/dev/null 2>&1 |
---|
532 | fi |
---|
533 | |
---|
534 | # check remaining quotas other than root |
---|
535 | if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then |
---|
536 | if [ -x /sbin/convertquota ]; then |
---|
537 | # try to convert old quotas |
---|
538 | for mountpt in `cat /etc/mtab | awk '$4 ~ /quota/{print $2}'`; do |
---|
539 | if [ -f "$mountpt/quota.user" ]; then |
---|
540 | action $"Converting old user quota files: " \ |
---|
541 | /sbin/convertquota -u $mountpt && \ |
---|
542 | rm -f $mountpt/quota.user |
---|
543 | fi |
---|
544 | if [ -f "$mountpt/quota.group" ]; then |
---|
545 | action $"Converting old group quota files: " \ |
---|
546 | /sbin/convertquota -g $mountpt && \ |
---|
547 | rm -f $mountpt/quota.group |
---|
548 | fi |
---|
549 | done |
---|
550 | fi |
---|
551 | action $"Checking local filesystem quotas: " /sbin/quotacheck -aRnug |
---|
552 | fi |
---|
553 | |
---|
554 | if [ -x /sbin/quotaon ]; then |
---|
555 | action $"Enabling local filesystem quotas: " /sbin/quotaon -aug |
---|
556 | fi |
---|
557 | |
---|
558 | # Configure machine if necessary. |
---|
559 | if [ -f /.unconfigured ]; then |
---|
560 | if [ -x /usr/bin/plymouth ]; then |
---|
561 | /usr/bin/plymouth quit |
---|
562 | fi |
---|
563 | if [ -x /usr/bin/system-config-keyboard ]; then |
---|
564 | /usr/bin/system-config-keyboard |
---|
565 | fi |
---|
566 | if [ -x /usr/bin/passwd ]; then |
---|
567 | /usr/bin/passwd root |
---|
568 | fi |
---|
569 | if [ -x /usr/sbin/system-config-network-tui ]; then |
---|
570 | /usr/sbin/system-config-network-tui |
---|
571 | fi |
---|
572 | if [ -x /usr/sbin/timeconfig ]; then |
---|
573 | /usr/sbin/timeconfig |
---|
574 | fi |
---|
575 | if [ -x /usr/sbin/authconfig-tui ]; then |
---|
576 | /usr/sbin/authconfig-tui --nostart |
---|
577 | fi |
---|
578 | if [ -x /usr/sbin/ntsysv ]; then |
---|
579 | /usr/sbin/ntsysv --level 35 |
---|
580 | fi |
---|
581 | |
---|
582 | # Reread in network configuration data. |
---|
583 | if [ -f /etc/sysconfig/network ]; then |
---|
584 | . /etc/sysconfig/network |
---|
585 | |
---|
586 | # Reset the hostname. |
---|
587 | action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME} |
---|
588 | fi |
---|
589 | |
---|
590 | rm -f /.unconfigured |
---|
591 | fi |
---|
592 | |
---|
593 | # Clean out /etc. |
---|
594 | rm -f /fastboot /fsckoptions /forcefsck /.autofsck /halt /poweroff |
---|
595 | |
---|
596 | # Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might... |
---|
597 | _NEED_XFILES= |
---|
598 | [ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1 |
---|
599 | |
---|
600 | # Clean up /var |
---|
601 | rm -rf /var/lock/cvs/* /var/run/screen/* |
---|
602 | find /var/lock /var/run -type f -exec rm -f {} \; |
---|
603 | |
---|
604 | rm -f /var/lib/rpm/__db* &> /dev/null |
---|
605 | rm -f /var/gdm/.gdmfifo &> /dev/null |
---|
606 | |
---|
607 | { |
---|
608 | # Clean up utmp/wtmp |
---|
609 | >/var/run/utmp |
---|
610 | touch /var/log/wtmp |
---|
611 | chgrp utmp /var/run/utmp /var/log/wtmp |
---|
612 | chmod 0664 /var/run/utmp /var/log/wtmp |
---|
613 | chmod 0600 /var/log/btmp |
---|
614 | if [ -n "$_NEED_XFILES" ]; then |
---|
615 | >/var/run/utmpx |
---|
616 | touch /var/log/wtmpx |
---|
617 | chgrp utmp /var/run/utmpx /var/log/wtmpx |
---|
618 | chmod 0664 /var/run/utmpx /var/log/wtmpx |
---|
619 | fi |
---|
620 | |
---|
621 | # Clean up various /tmp bits |
---|
622 | rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* \ |
---|
623 | /tmp/.esd/* |
---|
624 | rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ |
---|
625 | /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ |
---|
626 | /tmp/scrollkeeper-* /tmp/ssh-* \ |
---|
627 | /dev/.in_sysinit |
---|
628 | # Make ICE directory |
---|
629 | mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1 |
---|
630 | chown root:root /tmp/.ICE-unix |
---|
631 | |
---|
632 | # Now turn on swap in case we swap to files. |
---|
633 | update_boot_stage RCswap |
---|
634 | action $"Enabling swap space: " swapon -a -e |
---|
635 | |
---|
636 | # Initialize the serial ports. |
---|
637 | if [ -f /etc/rc.serial ]; then |
---|
638 | . /etc/rc.serial |
---|
639 | fi |
---|
640 | |
---|
641 | update_boot_stage RCusbstorage |
---|
642 | |
---|
643 | # Load usb storage here, to match most other things |
---|
644 | if [ -n "$needusbstorage" ]; then |
---|
645 | modprobe usb-storage >/dev/null 2>&1 |
---|
646 | fi |
---|
647 | |
---|
648 | # Adjust symlinks as necessary in /boot to keep system services from |
---|
649 | # spewing messages about mismatched System maps and so on. |
---|
650 | if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ]; then |
---|
651 | ln -s -f System.map-`uname -r` /boot/System.map |
---|
652 | fi |
---|
653 | if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then |
---|
654 | ln -s -f System.map-`uname -r` /boot/System.map |
---|
655 | fi |
---|
656 | |
---|
657 | # Now that we have all of our basic modules loaded and the kernel going, |
---|
658 | # let's dump the syslog ring somewhere so we can find it later |
---|
659 | dmesg -s 131072 > /var/log/dmesg |
---|
660 | # Also keep kernel symbols around in case we need them for debugging |
---|
661 | i=5 |
---|
662 | while [ $i -ge 0 ] ; do |
---|
663 | if [ -f /var/log/ksyms.$i ] ; then |
---|
664 | mv /var/log/ksyms.$i /var/log/ksyms.$(($i+1)) |
---|
665 | fi |
---|
666 | i=$(($i-1)) |
---|
667 | done |
---|
668 | if [ "$KERNELVERSION" = "2.6" ]; then |
---|
669 | _ksyms=/proc/kallsyms |
---|
670 | else |
---|
671 | _ksyms=/proc/ksyms |
---|
672 | fi |
---|
673 | (/bin/date; |
---|
674 | /bin/uname -a; |
---|
675 | /bin/cat /proc/cpuinfo; |
---|
676 | /bin/cat /proc/modules; |
---|
677 | /bin/cat ${_ksyms}) >/var/log/ksyms.0 |
---|
678 | # create the crash indicator flag to warn on crashes, offer fsck with timeout |
---|
679 | touch /.autofsck |
---|
680 | kill -TERM `/sbin/pidof getkey` >/dev/null 2>&1 |
---|
681 | } & |
---|
682 | if [ "$PROMPT" != "no" ]; then |
---|
683 | /sbin/getkey i && touch /var/run/confirm |
---|
684 | fi |
---|
685 | wait |
---|
686 | |
---|
687 | # let plymouth know that we're leaving rc.sysinit |
---|
688 | if [ -x /usr/bin/plymouth ]; then |
---|
689 | /usr/bin/plymouth --sysinit |
---|
690 | fi |
---|
691 | |
---|