17c478bd9Sstevel@tonic-gate#!/sbin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 67c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 77c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 87c478bd9Sstevel@tonic-gate# with the License. 97c478bd9Sstevel@tonic-gate# 107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 137c478bd9Sstevel@tonic-gate# and limitations under the License. 147c478bd9Sstevel@tonic-gate# 157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# CDDL HEADER END 227c478bd9Sstevel@tonic-gate# 237c478bd9Sstevel@tonic-gate# 247c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate# Use is subject to license terms. 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 307c478bd9Sstevel@tonic-gate 31*fa9e4066Sahrensresult=$SMF_EXIT_OK 32*fa9e4066Sahrens 337c478bd9Sstevel@tonic-gate# Mount all local filesystems. 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gatecd /; /sbin/mountall -l >/dev/msglog 367c478bd9Sstevel@tonic-gaterc=$? 377c478bd9Sstevel@tonic-gateif [ $rc -ne 0 ]; then 387c478bd9Sstevel@tonic-gate msg="WARNING: /sbin/mountall -l failed: exit status $rc" 397c478bd9Sstevel@tonic-gate echo $msg 407c478bd9Sstevel@tonic-gate echo "$SMF_FMRI:" $msg >/dev/msglog 41*fa9e4066Sahrens result=$SMF_EXIT_ERR_FATAL 427c478bd9Sstevel@tonic-gatefi 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate# get rid of transient reboot entry in GRUB menu 457c478bd9Sstevel@tonic-gateif [ -f /stubboot/boot/grub/menu.lst ]; then 467c478bd9Sstevel@tonic-gate /sbin/bootadm -m update_temp -R /stubboot 477c478bd9Sstevel@tonic-gateelse 487c478bd9Sstevel@tonic-gate /sbin/bootadm -m update_temp 497c478bd9Sstevel@tonic-gatefi 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate# 527c478bd9Sstevel@tonic-gate# If there are non-global UFS filesystems with quotas, check and enable them. 537c478bd9Sstevel@tonic-gate# 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate# vlist is the non-global filesystems in vfstab requesting quotas 567c478bd9Sstevel@tonic-gatevlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" { 577c478bd9Sstevel@tonic-gate if (match($7, "(^|,)(quota|rq)(,|$)") != 0 && 587c478bd9Sstevel@tonic-gate match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab` 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateif [ -n "$vlist" ]; then 617c478bd9Sstevel@tonic-gate # mlist is the filesystems in mnttab that are ufs, mounted rw, 627c478bd9Sstevel@tonic-gate # and without quotas turned on 637c478bd9Sstevel@tonic-gate mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" { 647c478bd9Sstevel@tonic-gate if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'` 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate # qlist is the intersection of vlist and mlist 677c478bd9Sstevel@tonic-gate qlist=`echo "$vlist\n-\n$mlist" | \ 687c478bd9Sstevel@tonic-gate /usr/bin/nawk '{if ($1 == "-") { mlist = 1; } 697c478bd9Sstevel@tonic-gate else if (mlist == 0) { vlist[$1] = 1; } 707c478bd9Sstevel@tonic-gate else if (vlist[$1]) { print $1; } }'` 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate # 737c478bd9Sstevel@tonic-gate # Just check and enable the non-global UFS file systems with quotas 747c478bd9Sstevel@tonic-gate # enabled. Note that "quotacheck -a" and "quotaon -a" will try 757c478bd9Sstevel@tonic-gate # to process all UFS entries with quotas rather than excluding 767c478bd9Sstevel@tonic-gate # the entries with the global option (the global entries are handled 777c478bd9Sstevel@tonic-gate # later in another script if the cluster package is installed). 787c478bd9Sstevel@tonic-gate # 797c478bd9Sstevel@tonic-gate if [ -n "$qlist" ]; then 807c478bd9Sstevel@tonic-gate echo 'Checking UFS quotas: \c' 817c478bd9Sstevel@tonic-gate /usr/sbin/quotacheck -p $qlist 827c478bd9Sstevel@tonic-gate echo 'done.' 837c478bd9Sstevel@tonic-gate /usr/sbin/quotaon $qlist 847c478bd9Sstevel@tonic-gate fi 857c478bd9Sstevel@tonic-gatefi 867c478bd9Sstevel@tonic-gate 87*fa9e4066Sahrens# Mount all ZFS filesystems. 88*fa9e4066Sahrens 89*fa9e4066Sahrensif [ -x /usr/sbin/zfs ]; then 90*fa9e4066Sahrens /usr/sbin/zfs mount -a >/dev/msglog 2>&1 91*fa9e4066Sahrens rc=$? 92*fa9e4066Sahrens if [ $rc -ne 0 ]; then 93*fa9e4066Sahrens msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc" 94*fa9e4066Sahrens echo $msg 95*fa9e4066Sahrens echo "$SMF_FMRI:" $msg >/dev/msglog 96*fa9e4066Sahrens result=$SMF_EXIT_ERR_FATAL 97*fa9e4066Sahrens fi 98*fa9e4066Sahrensfi 99*fa9e4066Sahrens 100*fa9e4066Sahrensexit $result 101