#!/bin/bash # $Id$ #%rlevels: 7:s #%start: 30 #%stop: #deps #%needs: #%before: #%after: source /etc/conf.d/rc source ${rc_functions} case "$1" in start) # stops annoying kernel messages echo "0" > /proc/sys/kernel/printk if [ -f /fastboot ] then rc_echo "Fast boot requested, will not perform file system checks ..." exit 0 fi rc_print "Mounting root file system in read-only mode ..." mount -n -o remount,ro / evaluate_retval if [ $? != 0 ] then $FAILURE rc_echo rc_echo "Cannot check root file system because it could not" rc_echo "be mounted in read-only mode." rc_echo rc_echo -n "When you press enter, this system will be halted." $NORMAL rc_echo rc_echo "Press enter to continue ..." read rc_echo "gonna run: $rc_base/init.d/halt" $rc_base/init.d/halt fi if [ -f /forcefsck ] then rc_echo "/forcefsck exists, forcing file system check" options="-f" else options="" fi rc_print "Checking file systems ..." #Note: -a option used to be -p; but this fails e.g. on fsck.minix fsck $options -a -A -C -T error_value=$? if [ "$error_value" = 1 ] then $WARNING rc_echo "File system errors were found and have been corrected." rc_echo "You may want to double-check that everything was fixed" rc_echo -n "properly" $NORMAL print_status warning fi if [ "$error_value" = 0 ] then print_status success fi if [ "$error_value" = 2 ] then $WARNING rc_echo "File system errors were found and have been corrected, but" rc_echo "the nature of the errors require this system to be rebooted." rc_echo rc_echo -n "When you press enter, this system will be rebooted." $NORMAL print_status warning rc_echo rc_echo "Please press enter to continue ..." read $rc_base/init.d/reboot fi if [ "$error_value" -gt 2 -a "$error_value" -lt 16 ] then $FAILURE rc_echo "File system errors were encountered that couldn't be" rc_echo "fixed automatically. This system cannot continue to boot" rc_echo "and will therefore be halted until those errors fixed manually" rc_echo "by a System Administrator." rc_echo rc_echo -n "When you press enter, this system will be halted." $NORMAL print_status failure rc_echo rc_echo "Press enter to continue ..." rc_echo $rc_base/init.d/halt fi #sets default level for kernel messages echo "3" > /proc/sys/kernel/printk update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; *) rc_echo "Usage: $0 {start}" exit 1 ;; esac