Subject: fsck -y during reboot
To: None <current-users@netbsd.org>
From: Martti Kuparinen <martti.kuparinen@iki.fi>
List: current-users
Date: 10/15/2003 20:26:18
Hi!

Could we have something like this? It would be nice if I can force file
system check on remote servers (=no access to the console) with

fsck_y=YES

in /etc/rc.conf. Comments?

Feel free to substitute the variable name with something better...

Martti


Index: fsck
===================================================================
RCS file: /cvsroot/src/etc/rc.d/fsck,v
retrieving revision 1.2
diff -u -r1.2 fsck
--- fsck	2001/06/18 06:42:35	1.2
+++ fsck	2003/10/15 17:21:15
@@ -46,8 +46,20 @@
 			stop_boot
 			;;
 		8)
-			echo "Automatic file system check failed; help!"
-			stop_boot
+			if ! checkyesno fsck_y; then
+				echo "Automatic file system check failed; help!"
+				stop_boot
+			fi
+			echo "Trying fsck -y"
+			fsck -y
+			case $? in
+			0)
+				;;
+			*)
+				echo "Automatic file system check failed; help!"
+				stop_boot
+				;;
+			esac
 			;;
 		12)
 			echo "Boot interrupted."