fsck revision 193944
10Sstevel@tonic-gate#!/bin/sh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# $FreeBSD: head/etc/rc.d/fsck 193944 2009-06-10 19:03:23Z avg $ 40Sstevel@tonic-gate# 50Sstevel@tonic-gate 60Sstevel@tonic-gate# PROVIDE: fsck 70Sstevel@tonic-gate# REQUIRE: localswap 80Sstevel@tonic-gate# KEYWORD: nojail 90Sstevel@tonic-gate 100Sstevel@tonic-gate. /etc/rc.subr 110Sstevel@tonic-gate 120Sstevel@tonic-gatename="fsck" 130Sstevel@tonic-gatestart_cmd="fsck_start" 140Sstevel@tonic-gatestop_cmd=":" 150Sstevel@tonic-gate 160Sstevel@tonic-gatefsck_start() 170Sstevel@tonic-gate{ 180Sstevel@tonic-gate if [ "$autoboot" = no ]; then 190Sstevel@tonic-gate echo "Fast boot: skipping disk checks." 200Sstevel@tonic-gate elif [ ! -r /etc/fstab ]; then 210Sstevel@tonic-gate echo "Warning! No /etc/fstab: skipping disk checks." 220Sstevel@tonic-gate elif [ "$autoboot" = yes ]; then 230Sstevel@tonic-gate # During fsck ignore SIGQUIT 240Sstevel@tonic-gate trap : 3 250Sstevel@tonic-gate 260Sstevel@tonic-gate [ -z "${rc_quiet}" ] && echo "Starting file system checks:" 270Sstevel@tonic-gate if checkyesno background_fsck; then 280Sstevel@tonic-gate fsck -F -p 290Sstevel@tonic-gate else 300Sstevel@tonic-gate fsck -p 310Sstevel@tonic-gate fi 320Sstevel@tonic-gate 330Sstevel@tonic-gate case $? in 340Sstevel@tonic-gate 0) 350Sstevel@tonic-gate ;; 360Sstevel@tonic-gate 2) 370Sstevel@tonic-gate stop_boot 380Sstevel@tonic-gate ;; 390Sstevel@tonic-gate 4) 400Sstevel@tonic-gate echo "Rebooting..." 410Sstevel@tonic-gate reboot 420Sstevel@tonic-gate echo "Reboot failed; help!" 430Sstevel@tonic-gate stop_boot 440Sstevel@tonic-gate ;; 450Sstevel@tonic-gate 8) 460Sstevel@tonic-gate if checkyesno fsck_y_enable; then 470Sstevel@tonic-gate echo "File system preen failed, trying fsck -y ${fsck_y_flags}" 480Sstevel@tonic-gate fsck -y ${fsck_y_flags} 490Sstevel@tonic-gate case $? in 500Sstevel@tonic-gate 0) 510Sstevel@tonic-gate ;; 520Sstevel@tonic-gate *) 530Sstevel@tonic-gate echo "Automatic file system check failed; help!" 540Sstevel@tonic-gate stop_boot 550Sstevel@tonic-gate ;; 560Sstevel@tonic-gate esac 570Sstevel@tonic-gate else 580Sstevel@tonic-gate echo "Automatic file system check failed; help!" 590Sstevel@tonic-gate stop_boot 600Sstevel@tonic-gate fi 610Sstevel@tonic-gate ;; 620Sstevel@tonic-gate 12) 630Sstevel@tonic-gate echo "Boot interrupted." 640Sstevel@tonic-gate stop_boot 650Sstevel@tonic-gate ;; 660Sstevel@tonic-gate 130) 670Sstevel@tonic-gate stop_boot 680Sstevel@tonic-gate ;; 690Sstevel@tonic-gate *) 700Sstevel@tonic-gate echo "Unknown error; help!" 710Sstevel@tonic-gate stop_boot 720Sstevel@tonic-gate ;; 730Sstevel@tonic-gate esac 740Sstevel@tonic-gate fi 750Sstevel@tonic-gate} 760Sstevel@tonic-gate 770Sstevel@tonic-gateload_rc_config $name 780Sstevel@tonic-gaterun_rc_command "$1" 790Sstevel@tonic-gate