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