#!/bin/bash # export the image of the CentOS-5.3 /var/cache/yum for updates # $Id: do_exports 1.2 2009/05/04 13:48:31 root Stable root $ function ExPort() { # See if the mount point is present SourcePt=$1 MountPt=/exports/$2 ExpOptions="${3:-rw,insecure,no_root_squash}" # see if the mount point exists [ -d ${MountPt} ] || mkdir -p ${MountPt} || return 2 # bind mount the directory where you export it # this avoids changing the mount in all user machines if ! mount | grep -q "${MountPt}.*bind"; then mount -o bind ${SourcePt} ${MountPt} || return 2 fi # now do the actual export exportfs -o ${ExpOptions} 10.4.60.0/23:${MountPt} } # unexport all, start over exportfs -uav # do the approved exports # /var/cache/yum for all CentOS 5.3 machines ExPort /mnt/tmp/backups/C53cache C53VCY # /var/cache/yum for FC11 ExPort /mnt/tmp/workspace/FC11/VCY/ FC11VCY # FC10 workspace ExPort /mnt/tmp/10space tenspace # in case the master copy of /common is down # machines will try to use this one ExPort /mnt/backups/common common ro,insecure