fsck revision 179945
178344Sobrien#!/bin/sh 278344Sobrien# 398184Sgordon# $FreeBSD: head/etc/rc.d/fsck 179945 2008-06-23 04:46:54Z mtm $ 478344Sobrien# 578344Sobrien 678344Sobrien# PROVIDE: fsck 778344Sobrien# REQUIRE: localswap 8136224Smtm# KEYWORD: nojail 978344Sobrien 1078344Sobrien. /etc/rc.subr 1178344Sobrien 1278344Sobrienname="fsck" 1378344Sobrienstart_cmd="fsck_start" 1478344Sobrienstop_cmd=":" 1578344Sobrien 1678344Sobrienfsck_start() 1778344Sobrien{ 1898184Sgordon if [ "$autoboot" = no ]; then 1978344Sobrien echo "Fast boot: skipping disk checks." 20126862Skientzle elif [ ! -r /etc/fstab ]; then 21126862Skientzle echo "Warning! No /etc/fstab: skipping disk checks." 2278344Sobrien elif [ "$autoboot" = yes ]; then 2378344Sobrien # During fsck ignore SIGQUIT 2478344Sobrien trap : 3 2578344Sobrien 26179945Smtm [ -z "${rc_quiet}" ] && echo "Starting file system checks:" 27124618Smtm if checkyesno background_fsck; then 28124618Smtm fsck -F -p 29124618Smtm else 3098184Sgordon fsck -p 31124618Smtm fi 3298184Sgordon 3378344Sobrien case $? in 3478344Sobrien 0) 3578344Sobrien ;; 3678344Sobrien 2) 3778344Sobrien stop_boot 3878344Sobrien ;; 3978344Sobrien 4) 4078344Sobrien echo "Rebooting..." 4178344Sobrien reboot 4278344Sobrien echo "Reboot failed; help!" 4378344Sobrien stop_boot 4478344Sobrien ;; 4578344Sobrien 8) 4698184Sgordon if checkyesno fsck_y_enable; then 4798184Sgordon echo "File system preen failed, trying fsck -y." 4898184Sgordon fsck -y 4998184Sgordon case $? in 5098184Sgordon 0) 5198184Sgordon ;; 5298184Sgordon *) 5398184Sgordon echo "Automatic file system check failed; help!" 5498184Sgordon stop_boot 5598184Sgordon ;; 5698184Sgordon esac 5798184Sgordon else 5898184Sgordon echo "Automatic file system check failed; help!" 5998184Sgordon stop_boot 6098184Sgordon fi 6198184Sgordon ;; 6278344Sobrien 12) 6378344Sobrien echo "Boot interrupted." 6478344Sobrien stop_boot 6578344Sobrien ;; 6678344Sobrien 130) 6778344Sobrien stop_boot 6878344Sobrien ;; 6978344Sobrien *) 7078344Sobrien echo "Unknown error; help!" 7178344Sobrien stop_boot 7278344Sobrien ;; 7378344Sobrien esac 7478344Sobrien fi 7578344Sobrien} 7678344Sobrien 7778344Sobrienload_rc_config $name 7878344Sobrienrun_rc_command "$1" 79