xref: /titanic_51/usr/src/cmd/fs.d/ufs/fsckall/fsckall.sh (revision 8a8d276f8934b606981d1c46b57c2eda30c67610)
1#!/sbin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# ident	"%Z%%M%	%I%	%E% SMI"
24#
25# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
26# Use is subject to license terms.
27#
28#	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
29#	  All Rights Reserved
30#
31
32#
33# Produce a list of the file systems that are not already
34# mounted.
35#
36for fsckdev in $* ; do
37	/usr/sbin/fsck -m -F ufs $fsckdev >/dev/null 2>&1
38	case $? in
39	33)	echo "$fsckdev already mounted"
40		;;
41
42	0)	echo "$fsckdev is clean"
43		;;
44
45	*)	ufs_fscklist="$ufs_fscklist $fsckdev"
46		;;
47	esac
48done
49
50#
51# Check the file systems in parallel
52#
53
54if [ "$ufs_fscklist" ]; then
55	echo "checking ufs filesystems"
56	/usr/sbin/fsck -o p $ufs_fscklist
57	case $? in
58	0|40|33)	# file system OK
59			exit 0
60			;;
61
62	*)	# couldn't fix the filesystems - return an error
63		exit 1
64		;;
65	esac
66fi
67
68exit 0
69