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
This commit is contained in:
parent
8313fc7094
commit
87fc4e29f5
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $NetBSD: fsck,v 1.9 2008/03/02 21:31:30 tron Exp $
|
# $NetBSD: fsck,v 1.10 2009/07/10 20:02:21 christos Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
# PROVIDE: fsck
|
# PROVIDE: fsck
|
||||||
@ -23,30 +23,7 @@ fsck_start()
|
|||||||
|
|
||||||
echo "Starting file system checks:"
|
echo "Starting file system checks:"
|
||||||
fsck $fsck_flags
|
fsck $fsck_flags
|
||||||
local fsck_error="$?"
|
handle_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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
load_rc_config $name
|
load_rc_config $name
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $NetBSD: fsck_root,v 1.2 2009/04/28 13:08:51 apb Exp $
|
# $NetBSD: fsck_root,v 1.3 2009/07/10 20:02:21 christos Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
# PROVIDE: fsck_root
|
# PROVIDE: fsck_root
|
||||||
@ -32,37 +32,19 @@ fsck_root_start()
|
|||||||
echo "Not checking /: fs_passno = 0 in ${fstab_file}"
|
echo "Not checking /: fs_passno = 0 in ${fstab_file}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
*:/:*) break
|
*:/:*) case "${fs_spec}" in
|
||||||
|
*:*)
|
||||||
|
echo "Not checking /: nfs mounted"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <"${fstab_file}"
|
done <"${fstab_file}"
|
||||||
|
|
||||||
echo "Starting root file system check:"
|
echo "Starting root file system check:"
|
||||||
fsck $fsck_flags /
|
fsck $fsck_flags /
|
||||||
local fsck_error="$?"
|
handle_fsck_error "$?"
|
||||||
case $fsck_error in
|
|
||||||
0) # OK
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
2) # Needs re-run, still fs errors
|
|
||||||
echo "file system still has 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
load_rc_config $name
|
load_rc_config $name
|
||||||
|
33
etc/rc.subr
33
etc/rc.subr
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: rc.subr,v 1.75 2009/04/28 03:03:52 reed Exp $
|
# $NetBSD: rc.subr,v 1.76 2009/07/10 20:02:21 christos Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -930,4 +930,35 @@ backup_file()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handle_fsck_error fsck_exit_code
|
||||||
|
# Take action depending on the return code from fsck.
|
||||||
|
#
|
||||||
|
handle_fsck_error()
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
0) # OK
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
2) # Needs re-run, still fs errors
|
||||||
|
echo "File system still has errors; re-run fsck manually!"
|
||||||
|
;;
|
||||||
|
4) # Root modified
|
||||||
|
echo "Root filesystem was modified, rebooting ..."
|
||||||
|
reboot -n
|
||||||
|
echo "Reboot failed; help!"
|
||||||
|
;;
|
||||||
|
8) # Check failed
|
||||||
|
echo "Automatic file system check failed; help!"
|
||||||
|
;;
|
||||||
|
12) # Got signal
|
||||||
|
echo "Boot interrupted."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown error $1; help!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
stop_boot
|
||||||
|
}
|
||||||
|
|
||||||
_rc_subr_loaded=:
|
_rc_subr_loaded=:
|
||||||
|
Loading…
Reference in New Issue
Block a user