sbin/fsck_hammer2: Allow -l to take multiple PFS names
[dragonfly.git] / etc / rc.d / fsck
1 #!/bin/sh
2 #
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 #
6
7 # PROVIDE: fsck
8 # REQUIRE: disks
9
10 . /etc/rc.subr
11
12 name="fsck"
13 start_cmd="fsck_start"
14 stop_cmd=":"
15
16 fsck_start()
17 {
18         if [ "$autoboot" = no ]; then
19                 echo "Fast boot: skipping disk checks."
20         elif [ "$autoboot" = yes ]; then
21                 # During fsck ignore SIGQUIT
22                 trap : 3
23
24                 echo "Starting file system checks:"
25                 fsck -p
26
27                 case $? in
28                 0)
29                         ;;
30                 2)
31                         stop_boot
32                         ;;
33                 4)
34                         echo "Rebooting..."
35                         reboot
36                         echo "Reboot failed; help!"
37                         stop_boot
38                         ;;
39                 8)
40                         if checkyesno fsck_y_enable; then
41                                 echo "File system preen failed, trying fsck -y."
42                                 fsck -y
43                                 case $? in
44                                 0)
45                                         ;;
46                                 *)
47                                         echo "Automatic file system check failed; help!"
48                                         stop_boot
49                                         ;;
50                                 esac
51                         else
52                                 echo "Automatic file system check failed; help!"
53                                 stop_boot
54                         fi
55                         ;;
56                 12)
57                         echo "Boot interrupted."
58                         stop_boot
59                         ;;
60                 130)
61                         stop_boot
62                         ;;
63                 *)
64                         echo "Unknown error; help!"
65                         stop_boot
66                         ;;
67                 esac
68         fi
69 }
70
71 load_rc_config $name
72 run_rc_command "$1"