HAMMER 60F/Many: Mirroring
[dragonfly.git] / etc / rc.d / fsck
blob9e119bf0cfb37c0636bb5a60a22ef308b2a95b7f
1 #!/bin/sh
3 # $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/fsck,v 1.4 2002/10/12 10:31:31 schweikh Exp $
5 # $DragonFly: src/etc/rc.d/fsck,v 1.4 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: fsck
9 # REQUIRE: localswap
11 . /etc/rc.subr
13 name="fsck"
14 start_cmd="fsck_start"
15 stop_cmd=":"
17 stop_boot()
19 # Terminate the process (which may include the parent /etc/rc)
20 # if booting directly to multiuser mode.
22 if [ "$autoboot" = yes ]; then
23 kill -TERM $$
25 exit 1
28 fsck_start()
30 if [ "$autoboot" = no ]; then
31 echo "Fast boot: skipping disk checks."
32 elif [ "$autoboot" = yes ]; then
33 # During fsck ignore SIGQUIT
34 trap : 3
36 echo "Starting file system checks:"
37 fsck -p
39 case $? in
43 stop_boot
46 echo "Rebooting..."
47 reboot
48 echo "Reboot failed; help!"
49 stop_boot
52 if checkyesno fsck_y_enable; then
53 echo "File system preen failed, trying fsck -y."
54 fsck -y
55 case $? in
59 echo "Automatic file system check failed; help!"
60 stop_boot
62 esac
63 else
64 echo "Automatic file system check failed; help!"
65 stop_boot
68 12)
69 echo "Boot interrupted."
70 stop_boot
72 130)
73 stop_boot
76 echo "Unknown error; help!"
77 stop_boot
79 esac
83 load_rc_config $name
84 run_rc_command "$1"