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