#!/usr/bin/ksh -p # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # ################################################################################ # sanitize PATH, and ensure required components are in front PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PATH} export PATH BINDIR="`cd ${0%/*}; pwd`" ETCDIR="`cd ${BINDIR}/../etc; pwd`" PATH=${BINDIR}:${PATH} export PATH MEDIALOC=${ETCDIR}/solaris_iso_locations if [ "$#" != "0" ]; then echo "Usage: $0" echo " " exit 1 fi # # Check to see if the media locations file exists. # for iso in `cat ${MEDIALOC} | grep -v "^#" | awk '{print $1}'` do lofiname="`lofiadm | awk '$2 == iso {print $1;}' iso=$iso`" if [ -z "${lofiname}" ]; then lofiname="`lofiadm -a $iso`" echo "Added $iso as lofi filesystem: $lofiname" fi mp="`cat ${MEDIALOC} | awk '$1 == iso {print $2;}' iso=$iso`" # As its in dfstab, stub might already be shared. shared="`share | awk '$2 == mp {print $2;}' mp=$mp`" mounted="`df -k | awk '$1 == lofiname && $6 == mp {print $6;}' lofiname=$lofiname mp=$mp`" if [ -z "${mounted}" ]; then if [ -n "${shared}" ]; then # We need to unshare so we can mount the filesystem unshare $mp shared="" fi mount -F hsfs $lofiname $mp mounted=$mp echo "Mounted $lofiname at $mp" fi if [ -z "${shared}" ]; then share -F nfs -o ro,anon=0 $mounted indfstab=`cat /etc/dfs/dfstab | awk '$6==mnt {print $6}' mnt="$mounted"` if [ -z "${indfstab}" ]; then echo "share -F nfs -o ro,anon=0 $mounted" >> /etc/dfs/dfstab fi echo "Shared $mounted" fi # Deal with lofi mount in x86 mountboot="`cat /etc/vfstab | awk '$1 == mpboot {print $3;}' mpboot=\"$mp/boot\"`" if [ -n "${mountboot}" ]; then bootmounted="`df -k | awk '$1 == mpboot {print $6;}' mpboot=\"$mp/boot\"`" if [ -z "${bootmounted}" ]; then mount $mountboot echo "Remounted $mountboot" fi fi done