1*7c478bd9Sstevel@tonic-gate#!/sbin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 25*7c478bd9Sstevel@tonic-gate# 26*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc. All rights reserved. 27*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 28*7c478bd9Sstevel@tonic-gate# 29*7c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 30*7c478bd9Sstevel@tonic-gate# All Rights Reserved 31*7c478bd9Sstevel@tonic-gate# 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate# checkmessage "fsck_device | mount_point" 34*7c478bd9Sstevel@tonic-gate# 35*7c478bd9Sstevel@tonic-gate# Simple auxilary routine to the shell function checkfs. Prints out 36*7c478bd9Sstevel@tonic-gate# instructions for a manual file system check before entering the shell. 37*7c478bd9Sstevel@tonic-gate# 38*7c478bd9Sstevel@tonic-gatecheckmessage() { 39*7c478bd9Sstevel@tonic-gate echo "" > /dev/console 40*7c478bd9Sstevel@tonic-gate if [ "$1" != "" ] ; then 41*7c478bd9Sstevel@tonic-gate echo "WARNING - Unable to repair one or more \c" > /dev/console 42*7c478bd9Sstevel@tonic-gate echo "of the following filesystem(s):" > /dev/console 43*7c478bd9Sstevel@tonic-gate echo "\t$1" > /dev/console 44*7c478bd9Sstevel@tonic-gate else 45*7c478bd9Sstevel@tonic-gate echo "WARNING - Unable to repair one or more filesystems." \ 46*7c478bd9Sstevel@tonic-gate > /dev/console 47*7c478bd9Sstevel@tonic-gate fi 48*7c478bd9Sstevel@tonic-gate echo "Run fsck manually (fsck filesystem...)." > /dev/console 49*7c478bd9Sstevel@tonic-gate echo "" > /dev/console 50*7c478bd9Sstevel@tonic-gate} 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate# 53*7c478bd9Sstevel@tonic-gate# checkfs raw_device fstype mountpoint 54*7c478bd9Sstevel@tonic-gate# 55*7c478bd9Sstevel@tonic-gate# Check the file system specified. The return codes from fsck have the 56*7c478bd9Sstevel@tonic-gate# following meanings. 57*7c478bd9Sstevel@tonic-gate# 0 - file system is unmounted and okay 58*7c478bd9Sstevel@tonic-gate# 32 - file system is unmounted and needs checking (fsck -m only) 59*7c478bd9Sstevel@tonic-gate# 33 - file system is already mounted 60*7c478bd9Sstevel@tonic-gate# 34 - cannot stat device 61*7c478bd9Sstevel@tonic-gate# 36 - uncorrectable errors detected - terminate normally (4.1 code 8) 62*7c478bd9Sstevel@tonic-gate# 37 - a signal was caught during processing (4.1 exit 12) 63*7c478bd9Sstevel@tonic-gate# 39 - uncorrectable errors detected - terminate rightaway (4.1 code 8) 64*7c478bd9Sstevel@tonic-gate# 40 - for root, same as 0 (used by rcS to remount root) 65*7c478bd9Sstevel@tonic-gate# 66*7c478bd9Sstevel@tonic-gatecheckfs() { 67*7c478bd9Sstevel@tonic-gate /usr/sbin/fsck -F $2 -m $1 >/dev/null 2>&1 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate if [ $? -ne 0 ] 70*7c478bd9Sstevel@tonic-gate then 71*7c478bd9Sstevel@tonic-gate # Determine fsck options by file system type 72*7c478bd9Sstevel@tonic-gate case "$2" in 73*7c478bd9Sstevel@tonic-gate ufs) foptions="-o p" 74*7c478bd9Sstevel@tonic-gate ;; 75*7c478bd9Sstevel@tonic-gate *) foptions="-y" 76*7c478bd9Sstevel@tonic-gate ;; 77*7c478bd9Sstevel@tonic-gate esac 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate echo "The "$3" file system ("$1") is being checked." 80*7c478bd9Sstevel@tonic-gate /usr/sbin/fsck -F $2 ${foptions} $1 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate case $? in 83*7c478bd9Sstevel@tonic-gate 0|40) # file system OK 84*7c478bd9Sstevel@tonic-gate ;; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate *) # couldn't fix the file system 87*7c478bd9Sstevel@tonic-gate echo "/usr/sbin/fsck failed with exit code "$?"." 88*7c478bd9Sstevel@tonic-gate checkmessage "$1" 89*7c478bd9Sstevel@tonic-gate ;; 90*7c478bd9Sstevel@tonic-gate esac 91*7c478bd9Sstevel@tonic-gate fi 92*7c478bd9Sstevel@tonic-gate} 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate# 95*7c478bd9Sstevel@tonic-gate# Used to save an entry that we will want to mount either in 96*7c478bd9Sstevel@tonic-gate# a command file or as a mount point list. 97*7c478bd9Sstevel@tonic-gate# 98*7c478bd9Sstevel@tonic-gate# saveentry fstype options special mountp 99*7c478bd9Sstevel@tonic-gate# 100*7c478bd9Sstevel@tonic-gatesaveentry() { 101*7c478bd9Sstevel@tonic-gate if [ "$ALTM" ]; then 102*7c478bd9Sstevel@tonic-gate echo "/sbin/mount -F $1 $2 $3 $4" >> $ALTM 103*7c478bd9Sstevel@tonic-gate else 104*7c478bd9Sstevel@tonic-gate mntlist="$mntlist $4" 105*7c478bd9Sstevel@tonic-gate fi 106*7c478bd9Sstevel@tonic-gate} 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gatePATH=/usr/sbin:/usr/bin 110*7c478bd9Sstevel@tonic-gateUSAGE="Usage:\nmountall [-F FSType] [-l|-r|-g] [file_system_table]" 111*7c478bd9Sstevel@tonic-gateTYPES=all 112*7c478bd9Sstevel@tonic-gateFSTAB=/etc/vfstab 113*7c478bd9Sstevel@tonic-gateerr=0 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate# 116*7c478bd9Sstevel@tonic-gate# Process command line args 117*7c478bd9Sstevel@tonic-gate# 118*7c478bd9Sstevel@tonic-gatewhile getopts ?grlsF: c 119*7c478bd9Sstevel@tonic-gatedo 120*7c478bd9Sstevel@tonic-gate case $c in 121*7c478bd9Sstevel@tonic-gate g) GFLAG="g";; 122*7c478bd9Sstevel@tonic-gate r) RFLAG="r";; 123*7c478bd9Sstevel@tonic-gate l) LFLAG="l";; 124*7c478bd9Sstevel@tonic-gate s) SFLAG="s";; 125*7c478bd9Sstevel@tonic-gate F) FSType="$OPTARG"; 126*7c478bd9Sstevel@tonic-gate if [ "$TYPES" = "one" ] 127*7c478bd9Sstevel@tonic-gate then 128*7c478bd9Sstevel@tonic-gate echo "mountall: more than one FSType specified" 129*7c478bd9Sstevel@tonic-gate exit 2 130*7c478bd9Sstevel@tonic-gate fi 131*7c478bd9Sstevel@tonic-gate TYPES="one"; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate case $FSType in 134*7c478bd9Sstevel@tonic-gate ?????????*) 135*7c478bd9Sstevel@tonic-gate echo "mountall: FSType $FSType exceeds 8 characters" 136*7c478bd9Sstevel@tonic-gate exit 2 137*7c478bd9Sstevel@tonic-gate esac 138*7c478bd9Sstevel@tonic-gate ;; 139*7c478bd9Sstevel@tonic-gate \?) echo "$USAGE" 1>&2; exit 2;; 140*7c478bd9Sstevel@tonic-gate esac 141*7c478bd9Sstevel@tonic-gatedone 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gateshift `/usr/bin/expr $OPTIND - 1` # get past the processed args 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gateif [ $# -gt 1 ]; then 146*7c478bd9Sstevel@tonic-gate echo "mountall: multiple arguments not supported" 1>&2 147*7c478bd9Sstevel@tonic-gate echo "$USAGE" 1>&2 148*7c478bd9Sstevel@tonic-gate exit 2 149*7c478bd9Sstevel@tonic-gatefi 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate# get file system table name and make sure file exists 152*7c478bd9Sstevel@tonic-gateif [ $# = 1 ]; then 153*7c478bd9Sstevel@tonic-gate case $1 in 154*7c478bd9Sstevel@tonic-gate "-") FSTAB="" 155*7c478bd9Sstevel@tonic-gate ;; 156*7c478bd9Sstevel@tonic-gate *) FSTAB=$1 157*7c478bd9Sstevel@tonic-gate ;; 158*7c478bd9Sstevel@tonic-gate esac 159*7c478bd9Sstevel@tonic-gatefi 160*7c478bd9Sstevel@tonic-gate# 161*7c478bd9Sstevel@tonic-gate# if an alternate vfstab file is used or serial mode is specified, then 162*7c478bd9Sstevel@tonic-gate# use a mount command file 163*7c478bd9Sstevel@tonic-gate# 164*7c478bd9Sstevel@tonic-gateif [ $# = 1 -o "$SFLAG" ]; then 165*7c478bd9Sstevel@tonic-gate ALTM=/var/tmp/mount$$ 166*7c478bd9Sstevel@tonic-gate rm -f $ALTM 167*7c478bd9Sstevel@tonic-gatefi 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gateif [ "$FSTAB" != "" -a ! -s "$FSTAB" ] 170*7c478bd9Sstevel@tonic-gatethen 171*7c478bd9Sstevel@tonic-gate echo "mountall: file system table ($FSTAB) not found" 172*7c478bd9Sstevel@tonic-gate exit 1 173*7c478bd9Sstevel@tonic-gatefi 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate# 176*7c478bd9Sstevel@tonic-gate# Check for incompatible args 177*7c478bd9Sstevel@tonic-gate# 178*7c478bd9Sstevel@tonic-gateif [ "$GFLAG" = "g" -a "$RFLAG$LFLAG" != "" -o \ 179*7c478bd9Sstevel@tonic-gate "$RFLAG" = "r" -a "$GFLAG$LFLAG" != "" -o \ 180*7c478bd9Sstevel@tonic-gate "$LFLAG" = "l" -a "$RFLAG$GFLAG" != "" ] 181*7c478bd9Sstevel@tonic-gatethen 182*7c478bd9Sstevel@tonic-gate echo "mountall: options -g, -r and -l are mutually exclusive" 1>&2 183*7c478bd9Sstevel@tonic-gate echo "$USAGE" 1>&2 184*7c478bd9Sstevel@tonic-gate exit 2 185*7c478bd9Sstevel@tonic-gatefi 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gateif [ \( "$FSType" = "cachefs" -o "$FSType" = "nfs" \) -a "$LFLAG" = "l" ] 188*7c478bd9Sstevel@tonic-gatethen 189*7c478bd9Sstevel@tonic-gate echo "mountall: option -l and FSType are incompatible" 1>&2 190*7c478bd9Sstevel@tonic-gate echo "$USAGE" 1>&2 191*7c478bd9Sstevel@tonic-gate exit 2 192*7c478bd9Sstevel@tonic-gatefi 193*7c478bd9Sstevel@tonic-gateif [ "$FSType" -a "$FSType" != "nfs" -a "$RFLAG" = "r" ] 194*7c478bd9Sstevel@tonic-gatethen 195*7c478bd9Sstevel@tonic-gate echo "mountall: option -r and FSType are incompatible" 1>&2 196*7c478bd9Sstevel@tonic-gate echo "$USAGE" 1>&2 197*7c478bd9Sstevel@tonic-gate exit 2 198*7c478bd9Sstevel@tonic-gatefi 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate# file-system-table format: 201*7c478bd9Sstevel@tonic-gate# 202*7c478bd9Sstevel@tonic-gate# column 1: special- block special device or resource name 203*7c478bd9Sstevel@tonic-gate# column 2: fsckdev- char special device for fsck 204*7c478bd9Sstevel@tonic-gate# column 3: mountp- mount point 205*7c478bd9Sstevel@tonic-gate# column 4: fstype- File system type 206*7c478bd9Sstevel@tonic-gate# column 5: fsckpass- number if to be checked automatically 207*7c478bd9Sstevel@tonic-gate# column 6: automnt- yes/no for automatic mount 208*7c478bd9Sstevel@tonic-gate# column 7: mntopts- -o specific mount options 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate# White-space separates columns. 211*7c478bd9Sstevel@tonic-gate# Lines beginning with \"#\" are comments. Empty lines are ignored. 212*7c478bd9Sstevel@tonic-gate# a '-' in any field is a no-op. 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate# 215*7c478bd9Sstevel@tonic-gate# Read FSTAB, fsck'ing appropriate filesystems: 216*7c478bd9Sstevel@tonic-gate# 217*7c478bd9Sstevel@tonic-gateexec < $FSTAB 218*7c478bd9Sstevel@tonic-gatewhile read special fsckdev mountp fstype fsckpass automnt mntopts 219*7c478bd9Sstevel@tonic-gatedo 220*7c478bd9Sstevel@tonic-gate case $special in 221*7c478bd9Sstevel@tonic-gate '#'* | '') # Ignore comments, empty lines 222*7c478bd9Sstevel@tonic-gate continue ;; 223*7c478bd9Sstevel@tonic-gate '-') # Ignore no-action lines 224*7c478bd9Sstevel@tonic-gate continue 225*7c478bd9Sstevel@tonic-gate esac 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate if [ "$automnt" != "yes" ]; then 228*7c478bd9Sstevel@tonic-gate continue 229*7c478bd9Sstevel@tonic-gate fi 230*7c478bd9Sstevel@tonic-gate if [ "$FSType" -a "$FSType" != "$fstype" ]; then 231*7c478bd9Sstevel@tonic-gate # ignore different fstypes 232*7c478bd9Sstevel@tonic-gate continue 233*7c478bd9Sstevel@tonic-gate fi 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate if [ "$LFLAG" ]; then 236*7c478bd9Sstevel@tonic-gate # Skip entries that have the "global" option. 237*7c478bd9Sstevel@tonic-gate g=`/usr/bin/grep '\<global\>' << EOF 238*7c478bd9Sstevel@tonic-gate $mntopts 239*7c478bd9Sstevel@tonic-gate EOF` 240*7c478bd9Sstevel@tonic-gate if [ "$fstype" = "cachefs" -o "$fstype" = "nfs" -o "$g" ]; then 241*7c478bd9Sstevel@tonic-gate continue 242*7c478bd9Sstevel@tonic-gate fi 243*7c478bd9Sstevel@tonic-gate elif [ "$RFLAG" -a "$fstype" != "nfs" ]; then 244*7c478bd9Sstevel@tonic-gate continue 245*7c478bd9Sstevel@tonic-gate elif [ "$GFLAG" ]; then 246*7c478bd9Sstevel@tonic-gate # Skip entries that have don't the "global" option. 247*7c478bd9Sstevel@tonic-gate g=`/usr/bin/grep '\<global\>' << EOF 248*7c478bd9Sstevel@tonic-gate $mntopts 249*7c478bd9Sstevel@tonic-gate EOF` 250*7c478bd9Sstevel@tonic-gate if [ "$fstype" = "cachefs" -o "$fstype" = "nfs" -o -z "$g" ] 251*7c478bd9Sstevel@tonic-gate then 252*7c478bd9Sstevel@tonic-gate continue 253*7c478bd9Sstevel@tonic-gate fi 254*7c478bd9Sstevel@tonic-gate fi 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate if [ "$fstype" = "-" ]; then 257*7c478bd9Sstevel@tonic-gate echo "mountall: FSType of $special cannot be identified" 1>&2 258*7c478bd9Sstevel@tonic-gate continue 259*7c478bd9Sstevel@tonic-gate fi 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate if [ "$ALTM" -a "$mntopts" != "-" ]; then 262*7c478bd9Sstevel@tonic-gate OPTIONS="-o $mntopts" # Use mount options if any 263*7c478bd9Sstevel@tonic-gate else 264*7c478bd9Sstevel@tonic-gate OPTIONS="" 265*7c478bd9Sstevel@tonic-gate fi 266*7c478bd9Sstevel@tonic-gate 267*7c478bd9Sstevel@tonic-gate # 268*7c478bd9Sstevel@tonic-gate # Ignore entries already mounted 269*7c478bd9Sstevel@tonic-gate # 270*7c478bd9Sstevel@tonic-gate /usr/bin/grep " $mountp " /etc/mnttab >/dev/null 2>&1 && continue 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate # 273*7c478bd9Sstevel@tonic-gate # Can't fsck if no fsckdev is specified 274*7c478bd9Sstevel@tonic-gate # 275*7c478bd9Sstevel@tonic-gate if [ "$fsckdev" = "-" ]; then 276*7c478bd9Sstevel@tonic-gate saveentry $fstype "$OPTIONS" $special $mountp 277*7c478bd9Sstevel@tonic-gate continue 278*7c478bd9Sstevel@tonic-gate fi 279*7c478bd9Sstevel@tonic-gate # 280*7c478bd9Sstevel@tonic-gate # For fsck purposes, we make a distinction between file systems 281*7c478bd9Sstevel@tonic-gate # that have a /usr/lib/fs/<fstyp>/fsckall script and those 282*7c478bd9Sstevel@tonic-gate # that don't. For those that do, just keep a list of them 283*7c478bd9Sstevel@tonic-gate # and pass the list to the fsckall script for that file 284*7c478bd9Sstevel@tonic-gate # file system type. 285*7c478bd9Sstevel@tonic-gate # 286*7c478bd9Sstevel@tonic-gate if [ -x /usr/lib/fs/$fstype/fsckall ]; then 287*7c478bd9Sstevel@tonic-gate 288*7c478bd9Sstevel@tonic-gate # 289*7c478bd9Sstevel@tonic-gate # add fstype to the list of fstypes for which 290*7c478bd9Sstevel@tonic-gate # fsckall should be called, if it's not already 291*7c478bd9Sstevel@tonic-gate # in the list. 292*7c478bd9Sstevel@tonic-gate # 293*7c478bd9Sstevel@tonic-gate found=no 294*7c478bd9Sstevel@tonic-gate if [ "$fsckall_fstypes" != "" ] ; then 295*7c478bd9Sstevel@tonic-gate for fst in $fsckall_fstypes; do 296*7c478bd9Sstevel@tonic-gate if [ "$fst" = "$fstype" ] ; then 297*7c478bd9Sstevel@tonic-gate found=yes 298*7c478bd9Sstevel@tonic-gate break 299*7c478bd9Sstevel@tonic-gate fi 300*7c478bd9Sstevel@tonic-gate done 301*7c478bd9Sstevel@tonic-gate fi 302*7c478bd9Sstevel@tonic-gate if [ $found = no ] ; then 303*7c478bd9Sstevel@tonic-gate fsckall_fstypes="$fsckall_fstypes ${fstype}" 304*7c478bd9Sstevel@tonic-gate fi 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate # 307*7c478bd9Sstevel@tonic-gate # add the device to the name of devices to be passed 308*7c478bd9Sstevel@tonic-gate # to the fsckall program for this file system type 309*7c478bd9Sstevel@tonic-gate # 310*7c478bd9Sstevel@tonic-gate cmd="${fstype}_fscklist=\"\$${fstype}_fscklist $fsckdev\"" 311*7c478bd9Sstevel@tonic-gate eval $cmd 312*7c478bd9Sstevel@tonic-gate saveentry $fstype "$OPTIONS" $special $mountp 313*7c478bd9Sstevel@tonic-gate continue 314*7c478bd9Sstevel@tonic-gate fi 315*7c478bd9Sstevel@tonic-gate # 316*7c478bd9Sstevel@tonic-gate # fsck everything else: 317*7c478bd9Sstevel@tonic-gate # 318*7c478bd9Sstevel@tonic-gate # fsck -m simply returns true if the filesystem is suitable for 319*7c478bd9Sstevel@tonic-gate # mounting. 320*7c478bd9Sstevel@tonic-gate # 321*7c478bd9Sstevel@tonic-gate /usr/sbin/fsck -m -F $fstype $fsckdev >/dev/null 2>&1 322*7c478bd9Sstevel@tonic-gate case $? in 323*7c478bd9Sstevel@tonic-gate 0|40) saveentry $fstype "$OPTIONS" $special $mountp 324*7c478bd9Sstevel@tonic-gate continue 325*7c478bd9Sstevel@tonic-gate ;; 326*7c478bd9Sstevel@tonic-gate 32) checkfs $fsckdev $fstype $mountp 327*7c478bd9Sstevel@tonic-gate saveentry $fstype "$OPTIONS" $special $mountp 328*7c478bd9Sstevel@tonic-gate continue 329*7c478bd9Sstevel@tonic-gate ;; 330*7c478bd9Sstevel@tonic-gate 33) # already mounted 331*7c478bd9Sstevel@tonic-gate echo "$special already mounted" 332*7c478bd9Sstevel@tonic-gate ;; 333*7c478bd9Sstevel@tonic-gate 34) # bogus special device 334*7c478bd9Sstevel@tonic-gate echo "Cannot stat $fsckdev - ignoring" 335*7c478bd9Sstevel@tonic-gate err=1 336*7c478bd9Sstevel@tonic-gate ;; 337*7c478bd9Sstevel@tonic-gate *) # uncorrectable errors 338*7c478bd9Sstevel@tonic-gate echo "$fsckdev uncorrectable error" 339*7c478bd9Sstevel@tonic-gate err=1 340*7c478bd9Sstevel@tonic-gate ;; 341*7c478bd9Sstevel@tonic-gate esac 342*7c478bd9Sstevel@tonic-gatedone 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate# 345*7c478bd9Sstevel@tonic-gate# Call the fsckall programs 346*7c478bd9Sstevel@tonic-gate# 347*7c478bd9Sstevel@tonic-gatefor fst in $fsckall_fstypes 348*7c478bd9Sstevel@tonic-gatedo 349*7c478bd9Sstevel@tonic-gate cmd="/usr/lib/fs/$fst/fsckall \$${fst}_fscklist" 350*7c478bd9Sstevel@tonic-gate eval $cmd 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate case $? in 353*7c478bd9Sstevel@tonic-gate 0) # file systems OK 354*7c478bd9Sstevel@tonic-gate ;; 355*7c478bd9Sstevel@tonic-gate 356*7c478bd9Sstevel@tonic-gate *) # couldn't fix some of the filesystems 357*7c478bd9Sstevel@tonic-gate echo "fsckall failed with exit code "$?"." 358*7c478bd9Sstevel@tonic-gate checkmessage 359*7c478bd9Sstevel@tonic-gate ;; 360*7c478bd9Sstevel@tonic-gate esac 361*7c478bd9Sstevel@tonic-gatedone 362*7c478bd9Sstevel@tonic-gate 363*7c478bd9Sstevel@tonic-gateif [ "$ALTM" ]; then 364*7c478bd9Sstevel@tonic-gate if [ ! -f "$ALTM" ]; then 365*7c478bd9Sstevel@tonic-gate exit 366*7c478bd9Sstevel@tonic-gate fi 367*7c478bd9Sstevel@tonic-gate /sbin/sh $ALTM # run the saved mount commands 368*7c478bd9Sstevel@tonic-gate /usr/bin/rm -f $ALTM 369*7c478bd9Sstevel@tonic-gate exit 370*7c478bd9Sstevel@tonic-gatefi 371*7c478bd9Sstevel@tonic-gate 372*7c478bd9Sstevel@tonic-gateif [ -n "$FSType" ]; then 373*7c478bd9Sstevel@tonic-gate /sbin/mount -a -F $FSType 374*7c478bd9Sstevel@tonic-gate exit 375*7c478bd9Sstevel@tonic-gatefi 376*7c478bd9Sstevel@tonic-gate 377*7c478bd9Sstevel@tonic-gateif [ "$RFLAG" ]; then 378*7c478bd9Sstevel@tonic-gate /sbin/mount -a -F nfs 379*7c478bd9Sstevel@tonic-gate exit 380*7c478bd9Sstevel@tonic-gatefi 381*7c478bd9Sstevel@tonic-gate 382*7c478bd9Sstevel@tonic-gateif [ "$LFLAG" -o "$GFLAG" -o $err != 0 ]; then 383*7c478bd9Sstevel@tonic-gate [ -z "$mntlist" ] || /sbin/mount -a $mntlist 384*7c478bd9Sstevel@tonic-gate exit 385*7c478bd9Sstevel@tonic-gatefi 386*7c478bd9Sstevel@tonic-gate 387*7c478bd9Sstevel@tonic-gate# else mount them all 388*7c478bd9Sstevel@tonic-gate 389*7c478bd9Sstevel@tonic-gate/sbin/mount -a 390