fsck revision 1.8
11.1Slukem#!/bin/sh 21.1Slukem# 31.8Schristos# $NetBSD: fsck,v 1.8 2008/02/24 01:05:35 christos Exp $ 41.1Slukem# 51.1Slukem 61.1Slukem# PROVIDE: fsck 71.1Slukem# REQUIRE: localswap 81.1Slukem 91.5Smycroft$_rc_subr_loaded . /etc/rc.subr 101.1Slukem 111.1Slukemname="fsck" 121.1Slukemstart_cmd="fsck_start" 131.1Slukemstop_cmd=":" 141.3Schristos 151.1Slukemfsck_start() 161.1Slukem{ 171.1Slukem if [ -e /fastboot ]; then 181.1Slukem echo "Fast boot: skipping disk checks." 191.8Schristos return 201.1Slukem fi 211.8Schristos trap : 2 # Ignore SIGINT, SIGQUIT, so we 221.8Schristos trap : 3 # enter single-user mode on failure. 231.8Schristos 241.8Schristos echo "Starting file system checks:" 251.8Schristos fsck $fsck_flags 261.8Schristos local fsck_error="$?" 271.8Schristos case $fsck_error in 281.8Schristos 0) # OK 291.8Schristos return 301.8Schristos ;; 311.8Schristos 2) # Needs re-run, still fs errors 321.8Schristos echo "file systems still have errors; re-run fsck manually!" 331.8Schristos ;; 341.8Schristos 4) # Root modified 351.8Schristos echo "Rebooting..." 361.8Schristos reboot 371.8Schristos echo "Reboot failed; help!" 381.8Schristos ;; 391.8Schristos 8) # Check failed 401.8Schristos echo "Automatic file system check failed; help!" 411.8Schristos ;; 421.8Schristos 12) # Got signal 431.8Schristos echo "Boot interrupted." 441.8Schristos ;; 451.8Schristos *) 461.8Schristos echo "Unknown error $fsck_error; help!" 471.8Schristos ;; 481.8Schristos esac 491.8Schristos stop_boot 501.1Slukem} 511.1Slukem 521.1Slukemload_rc_config $name 531.1Slukemrun_rc_command "$1" 54