head	1.11;
access;
symbols
	netbsd-11-0-RC4:1.11
	netbsd-11-0-RC3:1.11
	netbsd-11-0-RC2:1.11
	netbsd-11-0-RC1:1.11
	perseant-exfatfs-base-20250801:1.11
	netbsd-11:1.11.0.62
	netbsd-11-base:1.11
	netbsd-10-1-RELEASE:1.11
	perseant-exfatfs-base-20240630:1.11
	perseant-exfatfs:1.11.0.60
	perseant-exfatfs-base:1.11
	netbsd-8-3-RELEASE:1.11
	netbsd-9-4-RELEASE:1.11
	netbsd-10-0-RELEASE:1.11
	netbsd-10-0-RC6:1.11
	netbsd-10-0-RC5:1.11
	netbsd-10-0-RC4:1.11
	netbsd-10-0-RC3:1.11
	netbsd-10-0-RC2:1.11
	netbsd-10-0-RC1:1.11
	netbsd-10:1.11.0.58
	netbsd-10-base:1.11
	netbsd-9-3-RELEASE:1.11
	cjep_sun2x-base1:1.11
	cjep_sun2x:1.11.0.56
	cjep_sun2x-base:1.11
	cjep_staticlib_x-base1:1.11
	netbsd-9-2-RELEASE:1.11
	cjep_staticlib_x:1.11.0.54
	cjep_staticlib_x-base:1.11
	netbsd-9-1-RELEASE:1.11
	phil-wifi-20200421:1.11
	phil-wifi-20200411:1.11
	is-mlppp:1.11.0.52
	is-mlppp-base:1.11
	phil-wifi-20200406:1.11
	netbsd-8-2-RELEASE:1.11
	netbsd-9-0-RELEASE:1.11
	netbsd-9-0-RC2:1.11
	netbsd-9-0-RC1:1.11
	phil-wifi-20191119:1.11
	netbsd-9:1.11.0.50
	netbsd-9-base:1.11
	phil-wifi-20190609:1.11
	netbsd-8-1-RELEASE:1.11
	netbsd-8-1-RC1:1.11
	pgoyette-compat-merge-20190127:1.11
	pgoyette-compat-20190127:1.11
	pgoyette-compat-20190118:1.11
	pgoyette-compat-1226:1.11
	pgoyette-compat-1126:1.11
	pgoyette-compat-1020:1.11
	pgoyette-compat-0930:1.11
	pgoyette-compat-0906:1.11
	netbsd-7-2-RELEASE:1.11
	pgoyette-compat-0728:1.11
	netbsd-8-0-RELEASE:1.11
	phil-wifi:1.11.0.48
	phil-wifi-base:1.11
	pgoyette-compat-0625:1.11
	netbsd-8-0-RC2:1.11
	pgoyette-compat-0521:1.11
	pgoyette-compat-0502:1.11
	pgoyette-compat-0422:1.11
	netbsd-8-0-RC1:1.11
	pgoyette-compat-0415:1.11
	pgoyette-compat-0407:1.11
	pgoyette-compat-0330:1.11
	pgoyette-compat-0322:1.11
	pgoyette-compat-0315:1.11
	netbsd-7-1-2-RELEASE:1.11
	pgoyette-compat:1.11.0.46
	pgoyette-compat-base:1.11
	netbsd-7-1-1-RELEASE:1.11
	matt-nb8-mediatek:1.11.0.44
	matt-nb8-mediatek-base:1.11
	perseant-stdc-iso10646:1.11.0.42
	perseant-stdc-iso10646-base:1.11
	netbsd-8:1.11.0.40
	netbsd-8-base:1.11
	prg-localcount2-base3:1.11
	prg-localcount2-base2:1.11
	prg-localcount2-base1:1.11
	prg-localcount2:1.11.0.38
	prg-localcount2-base:1.11
	pgoyette-localcount-20170426:1.11
	bouyer-socketcan-base1:1.11
	pgoyette-localcount-20170320:1.11
	netbsd-7-1:1.11.0.36
	netbsd-7-1-RELEASE:1.11
	netbsd-7-1-RC2:1.11
	netbsd-7-nhusb-base-20170116:1.11
	bouyer-socketcan:1.11.0.34
	bouyer-socketcan-base:1.11
	pgoyette-localcount-20170107:1.11
	netbsd-7-1-RC1:1.11
	pgoyette-localcount-20161104:1.11
	netbsd-7-0-2-RELEASE:1.11
	localcount-20160914:1.11
	netbsd-7-nhusb:1.11.0.32
	netbsd-7-nhusb-base:1.11
	pgoyette-localcount-20160806:1.11
	pgoyette-localcount-20160726:1.11
	pgoyette-localcount:1.11.0.30
	pgoyette-localcount-base:1.11
	netbsd-7-0-1-RELEASE:1.11
	netbsd-7-0:1.11.0.28
	netbsd-7-0-RELEASE:1.11
	netbsd-7-0-RC3:1.11
	netbsd-7-0-RC2:1.11
	netbsd-7-0-RC1:1.11
	netbsd-5-2-3-RELEASE:1.9
	netbsd-5-1-5-RELEASE:1.9
	netbsd-6-0-6-RELEASE:1.11
	netbsd-6-1-5-RELEASE:1.11
	netbsd-7:1.11.0.26
	netbsd-7-base:1.11
	yamt-pagecache-base9:1.11
	yamt-pagecache-tag8:1.11
	netbsd-6-1-4-RELEASE:1.11
	netbsd-6-0-5-RELEASE:1.11
	tls-earlyentropy:1.11.0.24
	tls-earlyentropy-base:1.11
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.11
	riastradh-drm2-base3:1.11
	netbsd-6-1-3-RELEASE:1.11
	netbsd-6-0-4-RELEASE:1.11
	netbsd-5-2-2-RELEASE:1.9
	netbsd-5-1-4-RELEASE:1.9
	netbsd-6-1-2-RELEASE:1.11
	netbsd-6-0-3-RELEASE:1.11
	netbsd-5-2-1-RELEASE:1.9
	netbsd-5-1-3-RELEASE:1.9
	netbsd-6-1-1-RELEASE:1.11
	riastradh-drm2-base2:1.11
	riastradh-drm2-base1:1.11
	riastradh-drm2:1.11.0.16
	riastradh-drm2-base:1.11
	netbsd-6-1:1.11.0.22
	netbsd-6-0-2-RELEASE:1.11
	netbsd-6-1-RELEASE:1.11
	khorben-n900:1.11.0.20
	netbsd-6-1-RC4:1.11
	netbsd-6-1-RC3:1.11
	agc-symver:1.11.0.18
	agc-symver-base:1.11
	netbsd-6-1-RC2:1.11
	netbsd-6-1-RC1:1.11
	yamt-pagecache-base8:1.11
	netbsd-5-2:1.9.0.18
	netbsd-6-0-1-RELEASE:1.11
	yamt-pagecache-base7:1.11
	netbsd-5-2-RELEASE:1.9
	netbsd-5-2-RC1:1.9
	matt-nb6-plus-nbase:1.11
	yamt-pagecache-base6:1.11
	netbsd-6-0:1.11.0.14
	netbsd-6-0-RELEASE:1.11
	netbsd-6-0-RC2:1.11
	tls-maxphys:1.11.0.12
	tls-maxphys-base:1.11
	matt-nb6-plus:1.11.0.10
	matt-nb6-plus-base:1.11
	netbsd-6-0-RC1:1.11
	yamt-pagecache-base5:1.11
	yamt-pagecache-base4:1.11
	netbsd-6:1.11.0.8
	netbsd-6-base:1.11
	netbsd-5-1-2-RELEASE:1.9
	netbsd-5-1-1-RELEASE:1.9
	yamt-pagecache-base3:1.11
	yamt-pagecache-base2:1.11
	yamt-pagecache:1.11.0.6
	yamt-pagecache-base:1.11
	cherry-xenmp:1.11.0.4
	cherry-xenmp-base:1.11
	bouyer-quota2-nbase:1.11
	bouyer-quota2:1.11.0.2
	bouyer-quota2-base:1.11
	matt-mips64-premerge-20101231:1.11
	matt-nb5-mips64-premerge-20101231:1.9
	matt-nb5-pq3:1.9.0.16
	matt-nb5-pq3-base:1.9
	netbsd-5-1:1.9.0.14
	netbsd-5-1-RELEASE:1.9
	netbsd-5-1-RC4:1.9
	matt-nb5-mips64-k15:1.9
	netbsd-5-1-RC3:1.9
	netbsd-5-1-RC2:1.9
	netbsd-5-1-RC1:1.9
	netbsd-5-0-2-RELEASE:1.9
	matt-nb5-mips64-premerge-20091211:1.9
	matt-premerge-20091211:1.10
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.9
	matt-nb4-mips64-k7-u2a-k9b:1.9
	matt-nb5-mips64-u1-k1-k5:1.9
	matt-nb5-mips64:1.9.0.12
	netbsd-5-0-1-RELEASE:1.9
	jym-xensuspend-nbase:1.9
	netbsd-5-0:1.9.0.10
	netbsd-5-0-RELEASE:1.9
	netbsd-5-0-RC4:1.9
	netbsd-5-0-RC3:1.9
	netbsd-5-0-RC2:1.9
	jym-xensuspend:1.9.0.8
	jym-xensuspend-base:1.9
	netbsd-5-0-RC1:1.9
	mjf-devfs2-base2:1.9
	netbsd-5:1.9.0.6
	netbsd-5-base:1.9
	matt-mips64-base2:1.9
	matt-mips64:1.7.0.14
	netbsd-4-0-1-RELEASE:1.6
	wrstuden-revivesa-base-3:1.9
	wrstuden-revivesa-base-2:1.9
	wrstuden-fixsa-newbase:1.6
	wrstuden-revivesa-base-1:1.9
	yamt-pf42-base4:1.9
	yamt-pf42-base3:1.9
	hpcarm-cleanup-nbase:1.9
	yamt-pf42-baseX:1.9
	yamt-pf42-base2:1.9
	wrstuden-revivesa:1.9.0.4
	wrstuden-revivesa-base:1.9
	yamt-pf42:1.9.0.2
	yamt-pf42-base:1.9
	mjf-devfs2:1.7.0.12
	mjf-devfs2-base:1.9
	keiichi-mipv6:1.7.0.10
	keiichi-mipv6-base:1.9
	mjf-devfs:1.7.0.8
	mjf-devfs-base:1.7
	matt-armv6-nbase:1.9
	matt-armv6-prevmlocking:1.7
	wrstuden-fixsa-base-1:1.6
	netbsd-4-0:1.6.0.6
	netbsd-4-0-RELEASE:1.6
	cube-autoconf:1.7.0.6
	cube-autoconf-base:1.7
	netbsd-4-0-RC5:1.6
	netbsd-4-0-RC4:1.6
	netbsd-4-0-RC3:1.6
	netbsd-4-0-RC2:1.6
	netbsd-4-0-RC1:1.6
	matt-armv6:1.7.0.4
	matt-armv6-base:1.7
	matt-mips64-base:1.7
	hpcarm-cleanup:1.7.0.2
	hpcarm-cleanup-base:1.8
	netbsd-3-1-1-RELEASE:1.5.2.1
	netbsd-3-0-3-RELEASE:1.5
	wrstuden-fixsa:1.6.0.4
	wrstuden-fixsa-base:1.6
	abandoned-netbsd-4-base:1.5
	abandoned-netbsd-4:1.5.0.6
	netbsd-3-1:1.5.2.1.0.2
	netbsd-3-1-RELEASE:1.5.2.1
	netbsd-3-0-2-RELEASE:1.5
	netbsd-3-1-RC4:1.5.2.1
	netbsd-3-1-RC3:1.5
	netbsd-3-1-RC2:1.5
	netbsd-3-1-RC1:1.5
	netbsd-4:1.6.0.2
	netbsd-4-base:1.6
	netbsd-3-0-1-RELEASE:1.5
	netbsd-3-0:1.5.0.4
	netbsd-3-0-RELEASE:1.5
	netbsd-3-0-RC6:1.5
	netbsd-3-0-RC5:1.5
	netbsd-3-0-RC4:1.5
	netbsd-3-0-RC3:1.5
	netbsd-3-0-RC2:1.5
	netbsd-3-0-RC1:1.5
	netbsd-2-0-3-RELEASE:1.4
	netbsd-2-1:1.4.0.6
	netbsd-2-1-RELEASE:1.4
	netbsd-2-1-RC6:1.4
	netbsd-2-1-RC5:1.4
	netbsd-2-1-RC4:1.4
	netbsd-2-1-RC3:1.4
	netbsd-2-1-RC2:1.4
	netbsd-2-1-RC1:1.4
	netbsd-2-0-2-RELEASE:1.4
	netbsd-3:1.5.0.2
	netbsd-3-base:1.5
	netbsd-2-0-1-RELEASE:1.4
	netbsd-2:1.4.0.4
	netbsd-2-base:1.4
	netbsd-2-0-RELEASE:1.4
	netbsd-2-0-RC5:1.4
	netbsd-2-0-RC4:1.4
	netbsd-2-0-RC3:1.4
	netbsd-2-0-RC2:1.4
	netbsd-2-0-RC1:1.4
	netbsd-2-0:1.4.0.2
	netbsd-2-0-base:1.4
	netbsd-1-6-PATCH002-RELEASE:1.2.2.1
	netbsd-1-6-PATCH002:1.2.2.1
	netbsd-1-6-PATCH002-RC4:1.2.2.1
	netbsd-1-6-PATCH002-RC3:1.2.2.1
	netbsd-1-6-PATCH002-RC2:1.2.2.1
	netbsd-1-6-PATCH002-RC1:1.2.2.1
	netbsd-1-6-PATCH001:1.2
	netbsd-1-6-PATCH001-RELEASE:1.2
	netbsd-1-6-PATCH001-RC3:1.2
	netbsd-1-6-PATCH001-RC2:1.2
	netbsd-1-6-PATCH001-RC1:1.2
	fvdl_fs64_base:1.2
	netbsd-1-6-RELEASE:1.2
	netbsd-1-6-RC3:1.2
	netbsd-1-6-RC2:1.2
	netbsd-1-6-RC1:1.2
	netbsd-1-6:1.2.0.2
	netbsd-1-6-base:1.2
	netbsd-1-5-PATCH003:1.1.2.2
	netbsd-1-5-PATCH002:1.1.2.2
	netbsd-1-5-PATCH001:1.1.2.2
	netbsd-1-5-RELEASE:1.1.2.2
	netbsd-1-5-BETA2:1.1.2.2
	netbsd-1-5-BETA:1.1.2.2
	netbsd-1-5:1.1.0.2;
locks; strict;
comment	@# @;


1.11
date	2010.02.17.23.32.07;	author christos;	state Exp;
branches;
next	1.10;

1.10
date	2009.07.10.20.02.21;	author christos;	state Exp;
branches;
next	1.9;

1.9
date	2008.03.02.21.31.30;	author tron;	state Exp;
branches;
next	1.8;

1.8
date	2008.02.24.01.05.35;	author christos;	state Exp;
branches;
next	1.7;

1.7
date	2007.04.06.14.20.17;	author apb;	state Exp;
branches
	1.7.4.1
	1.7.10.1
	1.7.12.1;
next	1.6;

1.6
date	2006.10.07.04.11.23;	author riz;	state Exp;
branches;
next	1.5;

1.5
date	2004.08.13.18.08.03;	author mycroft;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2003.10.20.15.02.15;	author christos;	state Exp;
branches
	1.4.4.1;
next	1.3;

1.3
date	2003.10.15.17.38.04;	author christos;	state Exp;
branches;
next	1.2;

1.2
date	2001.06.18.06.42.35;	author lukem;	state Exp;
branches
	1.2.2.1;
next	1.1;

1.1
date	2000.08.21.23.38.07;	author lukem;	state Exp;
branches
	1.1.2.1;
next	;

1.7.4.1
date	2008.03.23.00.23.49;	author matt;	state Exp;
branches;
next	;

1.7.10.1
date	2008.03.24.07.14.42;	author keiichi;	state Exp;
branches;
next	;

1.7.12.1
date	2008.04.03.13.54.12;	author mjf;	state Exp;
branches;
next	;

1.5.2.1
date	2006.10.07.22.03.06;	author ghen;	state Exp;
branches;
next	;

1.4.4.1
date	2006.10.08.11.24.44;	author bouyer;	state Exp;
branches;
next	;

1.2.2.1
date	2003.10.27.04.42.44;	author jmc;	state Exp;
branches;
next	;

1.1.2.1
date	2000.08.21.23.38.07;	author lukem;	state dead;
branches;
next	1.1.2.2;

1.1.2.2
date	2000.08.23.12.32.17;	author lukem;	state Exp;
branches;
next	;


desc
@@


1.11
log
@Exclude root, since that is done in fsck_root.
@
text
@#!/bin/sh
#
# $NetBSD: fsck,v 1.10 2009/07/10 20:02:21 christos Exp $
#

# PROVIDE: fsck
# REQUIRE: localswap

$_rc_subr_loaded . /etc/rc.subr

name="fsck"
start_cmd="fsck_start"
stop_cmd=":"

fsck_start()
{
	if [ -e /fastboot ]; then
		echo "Fast boot: skipping disk checks."
		return
	fi
	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
	trap : 3		# enter single-user mode on failure.

	echo "Starting file system checks:"
	fsck -x / $fsck_flags
	handle_fsck_error "$?"
}

load_rc_config $name
run_rc_command "$1"
@


1.10
log
@1. centralize the fsck error handling
2. don't check if root is on nfs
3. reboot -n if root was modified as the manual page suggests
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.9 2008/03/02 21:31:30 tron Exp $
d25 1
a25 1
	fsck $fsck_flags
@


1.9
log
@Print out a message explaining why the system is rebooting if the root
filesystem is modified by fsck(8).
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.8 2008/02/24 01:05:35 christos Exp $
d26 1
a26 24
	local fsck_error="$?"
	case $fsck_error in
	0)	# OK
		return
		;;
	2)	# Needs re-run, still fs errors
		echo "file systems still have errors; re-run fsck manually!"
		;;
	4)	# Root modified
		echo "Root filesystem was modified, rebooting ..."
		reboot
		echo "Reboot failed; help!"
		;;
	8)	# Check failed
		echo "Automatic file system check failed; help!"
		;;
	12)	# Got signal
		echo "Boot interrupted."
		;;
	*)
		echo "Unknown error $fsck_error; help!"
		;;
	esac
	stop_boot
@


1.8
log
@cleanup fsck error handling:
1. explain what each error means
2. remove 130 (128 + 2) which was presumably there because fsck_msdos did
   not handle SIGINT properly
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.7 2007/04/06 14:20:17 apb Exp $
d35 1
a35 1
		echo "Rebooting..."
@


1.7
log
@* Add a stop_boot() function in rc.subr, to terminate a multi-user boot
  by killing the parent process.  The parent's PID is saved in $RC_PID.
* In all rc.d/* scripts that previously tried to stop the boot,
  replace in-line code with "stop_boot".
* Document this.

This should fix PR 29822.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.6 2006/10/07 04:11:23 riz Exp $
d19 1
a19 34
	else
		trap : 2		# Ignore SIGINT, SIGQUIT, so we
		trap : 3		# enter single-user mode on failure.

		echo "Starting file system checks:"
		fsck $fsck_flags
		case $? in
		0)
			;;
		2)
			stop_boot
			;;
		4)
			echo "Rebooting..."
			reboot
			echo "Reboot failed; help!"
			stop_boot
			;;
		8)
			echo "Automatic file system check failed; help!"
			stop_boot
			;;
		12)
			echo "Boot interrupted."
			stop_boot
			;;
		130)
			stop_boot
			;;
		*)
			echo "Unknown error; help!"
			stop_boot
			;;
		esac
d21 29
@


1.7.12.1
log
@Sync with HEAD.
@
text
@d3 1
a3 1
# $NetBSD$
d19 34
a52 1
		return
a53 29
	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
	trap : 3		# enter single-user mode on failure.

	echo "Starting file system checks:"
	fsck $fsck_flags
	local fsck_error="$?"
	case $fsck_error in
	0)	# OK
		return
		;;
	2)	# Needs re-run, still fs errors
		echo "file systems still have errors; re-run fsck manually!"
		;;
	4)	# Root modified
		echo "Root filesystem was modified, rebooting ..."
		reboot
		echo "Reboot failed; help!"
		;;
	8)	# Check failed
		echo "Automatic file system check failed; help!"
		;;
	12)	# Got signal
		echo "Boot interrupted."
		;;
	*)
		echo "Unknown error $fsck_error; help!"
		;;
	esac
	stop_boot
@


1.7.10.1
log
@sync with head.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.9 2008/03/02 21:31:30 tron Exp $
d19 34
a52 1
		return
a53 29
	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
	trap : 3		# enter single-user mode on failure.

	echo "Starting file system checks:"
	fsck $fsck_flags
	local fsck_error="$?"
	case $fsck_error in
	0)	# OK
		return
		;;
	2)	# Needs re-run, still fs errors
		echo "file systems still have errors; re-run fsck manually!"
		;;
	4)	# Root modified
		echo "Root filesystem was modified, rebooting ..."
		reboot
		echo "Reboot failed; help!"
		;;
	8)	# Check failed
		echo "Automatic file system check failed; help!"
		;;
	12)	# Got signal
		echo "Boot interrupted."
		;;
	*)
		echo "Unknown error $fsck_error; help!"
		;;
	esac
	stop_boot
@


1.7.4.1
log
@sync with HEAD
@
text
@d3 1
a3 1
# fsck,v 1.7 2007/04/06 14:20:17 apb Exp
d19 34
a52 1
		return
a53 29
	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
	trap : 3		# enter single-user mode on failure.

	echo "Starting file system checks:"
	fsck $fsck_flags
	local fsck_error="$?"
	case $fsck_error in
	0)	# OK
		return
		;;
	2)	# Needs re-run, still fs errors
		echo "file systems still have errors; re-run fsck manually!"
		;;
	4)	# Root modified
		echo "Root filesystem was modified, rebooting ..."
		reboot
		echo "Reboot failed; help!"
		;;
	8)	# Check failed
		echo "Automatic file system check failed; help!"
		;;
	12)	# Got signal
		echo "Boot interrupted."
		;;
	*)
		echo "Unknown error $fsck_error; help!"
		;;
	esac
	stop_boot
@


1.6
log
@Trap SIGINT so that if fsck is interrupted by ^C, we drop into single-user
mode.  Fixes misc/29822 from der Mouse, fix from Arnaud Lacombe with
comment rework by me.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.5 2004/08/13 18:08:03 mycroft Exp $
a14 11
stop_boot()
{
	#	Terminate the process (which may include the parent /etc/rc)
	#	if booting directly to multiuser mode.
	#
	if [ "$autoboot" = yes ]; then
		kill -TERM $$
	fi
	exit 1
}

@


1.5
log
@Add an _rc_subr_loaded variable, set to ":" by rc.subr.  Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.4 2003/10/20 15:02:15 christos Exp $
d31 2
a32 2
					# During fsck ignore SIGQUIT
		trap : 3
@


1.5.2.1
log
@Pull up following revision(s) (requested by riz in ticket #1542):
	etc/rc.d/fsck: revision 1.6
Trap SIGINT so that if fsck is interrupted by ^C, we drop into single-user
mode.  Fixes misc/29822 from der Mouse, fix from Arnaud Lacombe with
comment rework by me.
@
text
@d3 1
a3 1
# $NetBSD$
d31 2
a32 2
		trap : 2		# Ignore SIGINT, SIGQUIT, so we
		trap : 3		# enter single-user mode on failure.
@


1.4
log
@set fsck_flags=-p in /etc/defaults/rc.conf instead of checking if it is
empty in /etc/rc.d/fsck. From Bernd Ernesti.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.3 2003/10/15 17:38:04 christos Exp $
d9 1
a9 1
. /etc/rc.subr
@


1.4.4.1
log
@Pull up following revision(s) (requested by riz in ticket #10704):
	etc/rc.d/fsck: revision 1.6
Trap SIGINT so that if fsck is interrupted by ^C, we drop into single-user
mode.  Fixes misc/29822 from der Mouse, fix from Arnaud Lacombe with
comment rework by me.
@
text
@d3 1
a3 1
# $NetBSD$
d31 2
a32 2
		trap : 2		# Ignore SIGINT, SIGQUIT, so we
		trap : 3		# enter single-user mode on failure.
@


1.3
log
@Allow overrides via fsck_flags
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $
a13 5

if [ -z "$fsck_flags" ]
then
	fsck_flags="-p"
fi
@


1.2
log
@Now that "fsck -p" skips file systems that are mounted read-write,
always perform the disk check (unless /fastboot exists).  Previously
this would only occur when booting directly to multi-user, so the
fsck wouldn't happen after a single user boot going into multi-user.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.1 2000/08/21 23:38:07 lukem Exp $
d15 5
d40 1
a40 1
		fsck -p
@


1.2.2.1
log
@Pullup revs 1.3-1.4 (requested by martti in ticket #1543)

Allow custom fsck options via fsck_flags.
@
text
@d3 1
a3 1
# $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $
d35 1
a35 1
		fsck $fsck_flags
@


1.1
log
@convert fsck.sh -> fsck (using kill -TERM $$ to stop autoboot).
@
text
@d3 1
a3 1
# $NetBSD$
d30 1
a30 1
	elif [ "$autoboot" = yes ]; then
d34 1
a34 1
		echo "Automatic boot in progress: starting file system checks."
@


1.1.2.1
log
@file fsck was added on branch netbsd-1-5 on 2000-08-23 12:32:17 +0000
@
text
@d1 68
@


1.1.2.2
log
@pull up the following:
    etc/rc.d/Makefile	1.12
    etc/rc.d/fsck	1.1
    etc/rc.d/fsck.sh	REMOVE
replace fsck.sh with fsck (using kill -TERM $$ to stop autoboot).

approved: thorpej
@
text
@a0 68
#!/bin/sh
#
# $NetBSD: fsck,v 1.1.2.1 2000/08/23 12:32:17 lukem Exp $
#

# PROVIDE: fsck
# REQUIRE: localswap

. /etc/rc.subr

name="fsck"
start_cmd="fsck_start"
stop_cmd=":"

stop_boot()
{
	#	Terminate the process (which may include the parent /etc/rc)
	#	if booting directly to multiuser mode.
	#
	if [ "$autoboot" = yes ]; then
		kill -TERM $$
	fi
	exit 1
}

fsck_start()
{
	if [ -e /fastboot ]; then
		echo "Fast boot: skipping disk checks."
	elif [ "$autoboot" = yes ]; then
					# During fsck ignore SIGQUIT
		trap : 3

		echo "Automatic boot in progress: starting file system checks."
		fsck -p
		case $? in
		0)
			;;
		2)
			stop_boot
			;;
		4)
			echo "Rebooting..."
			reboot
			echo "Reboot failed; help!"
			stop_boot
			;;
		8)
			echo "Automatic file system check failed; help!"
			stop_boot
			;;
		12)
			echo "Boot interrupted."
			stop_boot
			;;
		130)
			stop_boot
			;;
		*)
			echo "Unknown error; help!"
			stop_boot
			;;
		esac
	fi
}

load_rc_config $name
run_rc_command "$1"
@
