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