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# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27#ident "%Z%%M% %I% %E% SMI" 28 29. /lib/svc/share/smf_include.sh 30 31# Mount all local filesystems. 32 33cd /; /sbin/mountall -l >/dev/msglog 34rc=$? 35if [ $rc -ne 0 ]; then 36 msg="WARNING: /sbin/mountall -l failed: exit status $rc" 37 echo $msg 38 echo "$SMF_FMRI:" $msg >/dev/msglog 39 exit $SMF_EXIT_ERR_FATAL 40fi 41 42# get rid of transient reboot entry in GRUB menu 43if [ -f /stubboot/boot/grub/menu.lst ]; then 44 /sbin/bootadm -m update_temp -R /stubboot 45else 46 /sbin/bootadm -m update_temp 47fi 48 49# 50# If there are non-global UFS filesystems with quotas, check and enable them. 51# 52 53# vlist is the non-global filesystems in vfstab requesting quotas 54vlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" { 55 if (match($7, "(^|,)(quota|rq)(,|$)") != 0 && 56 match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab` 57 58if [ -n "$vlist" ]; then 59 # mlist is the filesystems in mnttab that are ufs, mounted rw, 60 # and without quotas turned on 61 mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" { 62 if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'` 63 64 # qlist is the intersection of vlist and mlist 65 qlist=`echo "$vlist\n-\n$mlist" | \ 66 /usr/bin/nawk '{if ($1 == "-") { mlist = 1; } 67 else if (mlist == 0) { vlist[$1] = 1; } 68 else if (vlist[$1]) { print $1; } }'` 69 70 # 71 # Just check and enable the non-global UFS file systems with quotas 72 # enabled. Note that "quotacheck -a" and "quotaon -a" will try 73 # to process all UFS entries with quotas rather than excluding 74 # the entries with the global option (the global entries are handled 75 # later in another script if the cluster package is installed). 76 # 77 if [ -n "$qlist" ]; then 78 echo 'Checking UFS quotas: \c' 79 /usr/sbin/quotacheck -p $qlist 80 echo 'done.' 81 /usr/sbin/quotaon $qlist 82 fi 83fi 84 85exit $SMF_EXIT_OK 86