Example Mount Script

The following are the contents of 2 schell scripts which can be used as is or modified for mounting the build you wish. The important things to consider is the last section, which specifies the machine ("cinta03"), as well as the directory path the build is on ("drive1/421old/install/cd(blahblahbla)").
 
 

(by Gary Deen)

#!/usr/bin/ksh
#
# [$1] = Build  I.E. 10220330  - October 22, at 3:30am
# if unspecified, then get the most Current Build
#
REQBUILD="$1"
if [[ "$REQBUILD" = "-?" ]]; then
 print "Format: $0 [OptionalBuildDate]"
 print ""
 print "When OptionalBuildDate is blank, the current build is used."
 print "When an OptionBuildDate is specified, that build is used."
 print "The build is then linked to from \"/nasimgs\"."
 print "Change directories into \"/nasimgs/cd1\" to start a build."
 print
 print "Available builds:"
 ls /tools/WEA_R421
 exit 3
fi
PROGDIR=$(/usr/bin/dirname $0)
#
# run nfsc to connect to cinta03, until the builds no longer
# need the cinta03 images.
#
#$PROGDIR/nfsc1

function rmlinks
{
#
# Clean up any previous nasimgs directory, and set to empty
#
MYDIR="$1"
#print /usr/bin/mkdir -p $MYDIR
/usr/bin/mkdir -p $MYDIR 2> /dev/null
MDIRLIST=$(/usr/bin/ls $MYDIR)
for MDIR in $MDIRLIST ;
do
# print /usr/sbin/unlink $MYDIR/$MDIR
 /usr/sbin/unlink $MYDIR/$MDIR
done
}

function mountnas
{
#
# Mount the Network Attached Share with the builds at /nas
#
if [[ -d "/nas" ]]; then
 :
else
 print "No /nas"
#fi
#cd /nas 2>/dev/null
#CIWD2=`cd /nas 2>/dev/null && /usr/bin/pwd`
#cd - 2> /dev/null
#print $CIWD2

#if [[ "$CIWD2" != "/nas" ]]; then
 print usr/bin/mkdir /nas
 /usr/bin/mkdir /nas 2>/dev/null
fi
ISMOUNT=$(/usr/sbin/mount | /usr/bin/grep "nas" | /usr/bin/awk 'BEGIN{}
/nas300/ {print $3 };
END{}')
if [[ $ISMOUNT = "" ]]; then
 print /usr/sbin/mount -o ro nas300:/staging /nas
 /usr/sbin/mount -o ro nas300:/staging /nas
fi
}

function stripdotdot
{
string1="$1""/"
string2="$2"
#print $string1$string2
while [[ "`print $string2 | /usr/bin/head -c 3`" = "../" ]]; do
        #
        # remove "../" from front of string 2
        #
        WC=`print $string2|/usr/bin/wc -c`
        ((WC2 = WC - 3))
        MYLINK2=`print $string2|/usr/bin/tail -c $WC2`
        string2="$MYLINK2"
        #
        # remove last "/directory" from string1
        #

        junkstring1=`echo $string1 | /usr/bin/awk 'BEGIN { RS="/"; OSTR="";LAST="";LAST2=""}
                {
                OSTR=OSTR LAST2
                LAST2=LAST
                LAST=$1"/"
                }
        END{ print OSTR }'`
        string1=$junkstring1
done
        print $string1$string2
}

#
#
#
function linkdir
{
 #
 # $1 "Directory which contains links"
 # $2 "directory in which to copy these links."
 #
 # This routine will copy all of the links in a directory into another
 # directory. If the original directory contains links that are "../..",
 # then the links will be correctly repaired to not contain them.
 #

 #
 # for all images in NAS, make a link file to them
 #
 BUILDDIR="$1" # usually /nas/WEA_R421/CurrentBuild/cdlinks
 DESTDIR="$2" # usually /nasimgs

 cd $BUILDDIR 1>&2 2>/dev/null
 CWD=`/usr/bin/pwd`
 if [[ "$CWD" != "$BUILDDIR" ]]; then
  print
  print "cd $BUILDDIR has failed. Check mounts."
  exit 3
 fi

 FILES=`/usr/bin/ls .`
 cd - 1>&2 2> /dev/null
 print "Linking Build directories " $FILES

 for MDIR in $FILES ;
 do
  #MDIR == cd1
  MYLINK=`/usr/bin/ls -la $BUILDDIR/$MDIR | /usr/bin/awk 'BEGIN{}
   {print $11}
   END{}'`
  #MYLINK == "../../10230303/cdimg/cd1" or "/nas/WEA_R421/10230202/cdimg/cd1"
  if [[ `echo $MYLINK | /usr/bin/head -c 1` = '/' ]]; then
   /usr/bin/ln -s $MYLINK $DESTDIR/$MDIR
   echo 1 /usr/bin/ln -s $MYLINK $DESTDIR/$MDIR
  else
   MYLINK2=`stripdotdot "$BUILDDIR" "$MYLINK"`
   /usr/bin/ln -s $MYLINK2 $DESTDIR/$MDIR
   echo 2 /usr/bin/ln -s $MYLINK2 $DESTDIR/$MDIR
  fi
 done
}

function getrelease
{
MYDIR="$1"
cd $MYDIR 1>&2 2>/dev/null
if [[ "$(pwd)" != "$MYDIR" ]]; then
        print "MOUNT failed."
        exit 3
fi
RELEASE=`/usr/bin/ls | /usr/bin/grep [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]`
#cd - 1>&2 2> /dev/null
print $RELEASE
}
 

function fixupmissing
{
 #
 # for all directories in Jims Mounted last good build, get a link
 # this is because not all CDs are rebuilt at each build.
 #

 NEWDIR=$1
 cd /WEA/new 1>&2 2>/dev/null
 MFILES=`/usr/bin/ls .`
 cd - 1>&2 2> /dev/null

 for MDIR in $MFILES ;
 do
  if [[ -h "$NEWDIR/$MDIR" ]]; then
    :
  else
   print "Linking OLD build directories " $MDIR
   /usr/bin/ln -s /WEA/new/$MDIR $NEWDIR/$MDIR
   echo 3 /usr/bin/ln -s /WEA/new/$MDIR $NEWDIR/$MDIR
  fi
 done
}

if [[ "$REQBUILD" = "" ]]; then
 rmlinks /nasimgs
 mountnas
 linkdir "/nas/WEA_R421/CurrentBuild/cdlinks" "/nasimgs"

# fixupmissing "/nasimgs"

 RELEASE=`getrelease /nasimgs/cd1`
 cd - 1>&2 2> /dev/null
 if [[ -d "/tools/WEA_R421/$RELEASE" ]]; then
  :
 else
  rmlinks "/tools/WEA_R421/$RELEASE"
  linkdir "/nas/WEA_R421/CurrentBuild/cdlinks" "/tools/WEA_R421/$RELEASE"
#  fixupmissing "/tools/WEA_R421/$RELEASE"
 fi
else
 #
 # User typed in a build date for an argument.
 # Try and find this build date from a list of valid builds saved in /tools/gdeen/builds/WEA_R421
 #
 if [[ -d "/tools/WEA_R421/$REQBUILD" ]]; then
  rmlinks /nasimgs
  mountnas
  linkdir "/tools/WEA_R421/$REQBUILD" "/nasimgs"
 else
  print "Build Requested is not in /tools/WEA_R421"
  exit 3
 fi
fi
RELEASE=`getrelease /nasimgs/cd1`
print ""
print "CD /nasimgs/cd1 for the latest $RELEASE build"
 

(OR)  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
 

#!/bin/ksh

print  Fixing AIX/Linux Issue....
nfso -o nfs_use_reserved_ports=1
 

function mymount
{
echo Mounting $1 as $2
mkdir -p $2
/usr/sbin/mknfsmnt -f $2 -d $1 -h cinta03.raleigh.ibm.com -n -B -A -t ro -w bg -r 10 -Y -Z -X -H -j -q -g
}
echo  Mounting "cinta03 drive1/421"....

mymount /drive1/421/install/cd1 /WEA/new/cd1
mymount /drive1/421/install/cd2-1 /WEA/new/cd2-1
mymount /drive1/421/install/cd2-2 /WEA/new/cd2-2
mymount /drive1/421/install/cd2-3 /WEA/new/cd2-3
mymount /drive1/421/install/cd2-4 /WEA/new/cd2-4
mymount /drive1/421/install/cd2-5 /WEA/new/cd2-5
mymount /drive1/421/install/cd2-6 /WEA/new/cd2-6
mymount /drive1/421/install/cd2-7 /WEA/new/cd2-7
mymount /drive1/421/install/cd3 /WEA/new/cd3
mymount /drive1/421/install/cd4 /WEA/new/cd4
mymount /drive1/421/install/cd5 /WEA/new/cd5
mymount /drive1/421/install/cd6 /WEA/new/cd6
mymount /drive1/421/install/cd7 /WEA/new/cd7
mymount /drive1/421/install/cd8 /WEA/new/cd8
mymount /drive1/421/install/cd9 /WEA/new/cd9