#!/bin/bash #%rlevels: 7:s #%start: 30 #%stop: #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions # stops annoying kernel messages echo "0" > /proc/sys/kernel/printk if [ -f /fastboot ] then echo "Fast boot requested, will not perform file system checks ..." exit 0 fi echo -e ${COLOREDSTAR}"Mounting root file system in read-only mode ..." mount -n -o remount,ro / evaluate_retval if [ $? != 0 ] then $FAILURE echo echo "Cannot check root file system because it could not" echo "be mounted in read-only mode." echo echo -n "When you press enter, this system will be halted." $NORMAL echo echo "Press enter to continue ..." read echo "gonna run: $rc_base/init.d/halt" $rc_base/init.d/halt fi if [ -f /forcefsck ] then echo "/forcefsck exists, forcing file system check" options="-f" else options="" fi echo -e ${COLOREDSTAR}"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 echo "File system errors were found and have been corrected." echo "You may want to double-check that everything was fixed" echo -n "properly" $NORMAL print_status warning fi if [ "$error_value" = 0 ] then print_status success fi if [ "$error_value" = 2 ] then $WARNING echo "File system errors were found and have been corrected, but" echo "the nature of the errors require this system to be rebooted." echo echo -n "When you press enter, this system will be rebooted." $NORMAL print_status warning echo 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 echo "File system errors were encountered that couldn't be" echo "fixed automatically. This system cannot continue to boot" echo "and will therefore be halted until those errors fixed manually" echo "by a System Administrator." echo echo -n "When you press enter, this system will be halted." $NORMAL print_status failure echo echo "Press enter to continue ..." read $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