fsck revision 78345
1#!/bin/sh 2# 3# $NetBSD$ 4# 5 6# PROVIDE: fsck 7# REQUIRE: localswap 8 9. /etc/rc.subr 10 11name="fsck" 12start_cmd="fsck_start" 13stop_cmd=":" 14 15stop_boot() 16{ 17 # Terminate the process (which may include the parent /etc/rc) 18 # if booting directly to multiuser mode. 19 # 20 if [ "$autoboot" = yes ]; then 21 kill -TERM $$ 22 fi 23 exit 1 24} 25 26fsck_start() 27{ 28 if [ -e /fastboot ]; then 29 echo "Fast boot: skipping disk checks." 30 elif [ "$autoboot" = yes ]; then 31 # During fsck ignore SIGQUIT 32 trap : 3 33 34 echo "Automatic boot in progress: starting file system checks." 35 fsck -p 36 case $? in 37 0) 38 ;; 39 2) 40 stop_boot 41 ;; 42 4) 43 echo "Rebooting..." 44 reboot 45 echo "Reboot failed; help!" 46 stop_boot 47 ;; 48 8) 49 echo "Automatic file system check failed; help!" 50 stop_boot 51 ;; 52 12) 53 echo "Boot interrupted." 54 stop_boot 55 ;; 56 130) 57 stop_boot 58 ;; 59 *) 60 echo "Unknown error; help!" 61 stop_boot 62 ;; 63 esac 64 fi 65} 66 67load_rc_config $name 68run_rc_command "$1" 69