2011-01-16 19:32:23 +00:00
|
|
|
#!/bin/ksh
|
2010-09-12 22:17:39 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# aixlitesetup
|
|
|
|
# - This script is used to configure the xCAT statelite support
|
|
|
|
# for AIX
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
SL="/.statelite"
|
|
|
|
ROOTDIR="/"
|
|
|
|
MOUNTDIR="$SL/mnt" # where I mount all the trees.
|
|
|
|
PERSISTENT="$SL/persistent"
|
|
|
|
TMPDIR="$SL/tmpdir"
|
|
|
|
DEFAULT="/.default"
|
|
|
|
|
|
|
|
# statelite table files are in "/"
|
|
|
|
# /statelite.table, /litefile.table, /litetree.table
|
|
|
|
STATELITE="/statelite.table"
|
|
|
|
LITEFILE="/litefile.table"
|
|
|
|
LITETREE="/litetree.table"
|
|
|
|
LOG="${ROOTDIR}/${SL}/statelite.log"
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
ELIST=[] # entry list, each entry will contain the type and the path
|
|
|
|
|
2010-09-13 20:03:15 +00:00
|
|
|
# get this node name from the /etc/niminfo file
|
2011-01-16 19:32:23 +00:00
|
|
|
INFO=`/usr/bin/cat /etc/niminfo | grep 'NIM_HOSTNAME'`
|
|
|
|
ME=`echo $INFO | /usr/bin/awk -F= '{print $2}' | /usr/bin/awk -F. '{print $1}'`
|
|
|
|
|
2011-01-30 16:25:29 +00:00
|
|
|
if [ ! -s ${STATELITE} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
echo "no ${STATELITE} file"
|
|
|
|
echo "no ${STATELITE} file" >>$LOG
|
|
|
|
exit 0
|
|
|
|
fi
|
2011-01-30 16:25:29 +00:00
|
|
|
if [ ! -s ${LITEFILE} ]; then
|
|
|
|
echo "no ${LITEFILE} file"
|
|
|
|
echo "no ${LITEFILE} file" >>$LOG
|
|
|
|
exit 0
|
|
|
|
fi
|
2010-09-13 20:03:15 +00:00
|
|
|
|
2010-09-12 22:17:39 +00:00
|
|
|
# check the statelite.table file to see if we have
|
|
|
|
# a persistent dir to mount.
|
|
|
|
ProcessStatelite () {
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
for i in `/usr/bin/cat $STATELITE | /usr/bin/grep -v '^#' | /usr/bin/grep $ME`
|
2010-09-12 22:17:39 +00:00
|
|
|
do
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
SERVER=`echo $i | /usr/bin/awk -F'|' '{print $2}'`
|
|
|
|
TOMNT=`echo $i | /usr/bin/awk -F'|' '{print $3}'`
|
2011-04-13 19:19:31 +00:00
|
|
|
OPTS=`echo $i | /usr/bin/awk -F'|' '{print $4}'`
|
|
|
|
|
|
|
|
# ndebug
|
|
|
|
|
|
|
|
if [ "$OPTS" = "" ]; then
|
2011-07-08 00:20:57 +00:00
|
|
|
MNTOPTS=" -o llock "
|
2011-04-13 19:19:31 +00:00
|
|
|
else
|
2011-07-08 00:20:57 +00:00
|
|
|
MNTOPTS=" -o llock -o $OPTS "
|
2011-04-13 19:19:31 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# /.statelite/tmpdir
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${TMPDIR} ]; then
|
|
|
|
mkdir -m 755 -p ${TMPDIR}
|
|
|
|
fi
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# /.statelite/persistent
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${PERSISTENT} ]; then
|
|
|
|
mkdir -m 755 -p ${PERSISTENT}
|
|
|
|
fi
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# mount 10.2.0.200:/nodedata /.statelite/persistent
|
2011-04-13 19:19:31 +00:00
|
|
|
/usr/sbin/mount ${MNTOPTS} $SERVER:$TOMNT ${PERSISTENT}
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# make a node subdir
|
|
|
|
# /.statelite/persistent/<nodename>
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${PERSISTENT}/${ME} ]; then
|
|
|
|
mkdir -m 755 -p ${PERSISTENT}/${ME}
|
|
|
|
fi
|
2010-10-11 17:35:40 +00:00
|
|
|
|
2010-09-12 22:17:39 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# process the litefile table
|
|
|
|
ProcessLitefile () {
|
2011-01-16 19:32:23 +00:00
|
|
|
let j=0
|
|
|
|
for i in `/usr/bin/cat $LITEFILE | /usr/bin/grep $ME`
|
2010-09-12 22:17:39 +00:00
|
|
|
do
|
2011-01-30 20:30:26 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
type=`echo $i | /usr/bin/awk -F'|' '{print $2}'`
|
|
|
|
path=`echo $i | /usr/bin/awk -F'|' '{print $3}'`
|
|
|
|
|
|
|
|
# entry list one line per element
|
|
|
|
ELIST[$j]="$type $path";
|
|
|
|
let j=j+1;
|
|
|
|
done
|
|
|
|
|
|
|
|
# number of entries(lines) in file
|
|
|
|
num=${#ELIST[@]}
|
|
|
|
|
|
|
|
let i=0
|
|
|
|
while [ $i -lt $num ]; do
|
|
|
|
|
|
|
|
set -- ${ELIST[$i]}
|
|
|
|
etype=$1
|
|
|
|
epath=$2
|
|
|
|
|
|
|
|
# ex. for /etc/foo the parent is /etc/
|
|
|
|
parent="`/usr/bin/dirname $epath`/"
|
|
|
|
|
|
|
|
let efound=0
|
|
|
|
let ptype=0
|
|
|
|
let ppath=0
|
|
|
|
while [ "$parent" != "//" ]; do
|
|
|
|
let j=0
|
|
|
|
while [ $j -lt $num ]; do
|
|
|
|
set -- ${ELIST[$j]}
|
|
|
|
jtype=$1
|
|
|
|
jpath=$2
|
|
|
|
|
|
|
|
# see if a parent is also one of the file entries
|
|
|
|
if [ "$parent" = "$jpath" ]; then
|
|
|
|
efound=1
|
|
|
|
ptype=$jtype
|
|
|
|
ppath=$jpath
|
|
|
|
break 2
|
|
|
|
fi
|
|
|
|
let j=j+1;
|
|
|
|
done
|
|
|
|
parent="`/usr/bin/dirname $parent`/"
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$efound" = "1" ]; then
|
|
|
|
# found a parent & child on the list
|
|
|
|
|
2011-01-30 20:30:26 +00:00
|
|
|
cantdo=0
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# check options
|
|
|
|
# can't do any child that has parent of ro
|
|
|
|
if [ "$ptype" = "ro" ]; then
|
|
|
|
echo "Cannot add child ($epath) when parent ($ppath) has 'ro' option." >>$LOG
|
2011-01-30 20:30:26 +00:00
|
|
|
cantdo=1
|
2011-01-16 19:32:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# a persistent parent can't have a ro child
|
|
|
|
if [ "$ptype" = "persistent" ]; then
|
|
|
|
if [ "$etype" = "ro" ]; then
|
|
|
|
echo "Cannot add child ($epath) with 'ro' option when parent ($ppath) has 'persistent' option." >>$LOG
|
2011-01-30 20:30:26 +00:00
|
|
|
cantdo=1
|
2011-01-16 19:32:23 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-01-30 20:30:26 +00:00
|
|
|
if [ $cantdo -eq 0 ]; then
|
|
|
|
# ok - # put the child on into CLIST
|
|
|
|
cnum=${#CLIST[@]}
|
|
|
|
CLIST[$cnum]=${ELIST[$i]}
|
|
|
|
fi
|
2011-01-16 19:32:23 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
# add the parents and the entries with no parents to PLIST
|
|
|
|
let pfound=0
|
|
|
|
let pnum=${#PLIST[@]}
|
|
|
|
let k=0
|
|
|
|
while [ $k -lt $pnum ]; do
|
|
|
|
if [ "${PLIST[$k]}" = "${path}" ]; then
|
|
|
|
pfound=1
|
|
|
|
fi
|
|
|
|
let k=k+1
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$pfound" = "0" ]; then
|
|
|
|
# put it into PLIST
|
|
|
|
let plnum=${#PLIST[@]}
|
|
|
|
PLIST[$plnum]=${ELIST[$i]}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
let i=i+1;
|
|
|
|
done
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
plistnum=${#PLIST[@]}
|
|
|
|
n=0
|
|
|
|
while [ $n -lt $plistnum ]; do
|
|
|
|
set -- ${PLIST[$n]}
|
|
|
|
FindFile ${2} ${1} 0
|
|
|
|
let n=n+1
|
2010-09-12 22:17:39 +00:00
|
|
|
done
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
plistnum=${#CLIST[@]}
|
|
|
|
m=0
|
|
|
|
while [ $m -lt $plistnum ]; do
|
|
|
|
set -- ${CLIST[$m]}
|
|
|
|
FindFile ${2} ${1} 1
|
|
|
|
let m=m+1
|
|
|
|
done
|
2010-09-12 22:17:39 +00:00
|
|
|
}
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# mount the required directories from the server
|
2010-09-12 22:17:39 +00:00
|
|
|
MountTrees () {
|
|
|
|
# ex. /.statelite/mnt
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${MOUNTDIR} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p $MOUNTDIR
|
2010-10-13 16:40:26 +00:00
|
|
|
fi
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
for i in `/usr/bin/cat $LITETREE | /usr/bin/grep -v '^#' | /usr/bin/grep $ME`
|
2010-09-12 22:17:39 +00:00
|
|
|
do
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
NODE=`echo $i | /usr/bin/awk -F'|' '{print $1}'`
|
|
|
|
SERV=`echo $i | /usr/bin/awk -F'|' '{print $2}'`
|
|
|
|
DIR=`echo $i | /usr/bin/awk -F'|' '{print $3}'`
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${MOUNTDIR}/${SERV}${DIR} ]; then
|
|
|
|
# ex. /.statelite/mnt/10.2.0.200/etc/
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${MOUNTDIR}/${SERV}${DIR}
|
2010-10-13 16:40:26 +00:00
|
|
|
fi
|
2010-10-11 17:35:40 +00:00
|
|
|
|
2010-09-12 22:17:39 +00:00
|
|
|
MAX=5
|
|
|
|
TRIES=1
|
|
|
|
|
|
|
|
# ex. 10.2.0.200:/etc/ /.statelite/mnt/10.2.0.200/etc/
|
2011-07-08 00:20:57 +00:00
|
|
|
while ! /usr/sbin/mount -o llock $SERV:$DIR ${MOUNTDIR}/${SERV}${DIR}
|
2010-09-12 22:17:39 +00:00
|
|
|
do
|
|
|
|
if [ "$TRIES" = "$MAX" ]
|
|
|
|
then
|
|
|
|
echo "Cannot mount $i." >/dev/console
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
TRIES=`expr $TRIES + 1`
|
|
|
|
S=`expr $RANDOM % 20`
|
2011-01-16 19:32:23 +00:00
|
|
|
echo "Can't mount $SERV:$MNT... Sleeping $S seconds then trying again" >>$LOG
|
2010-09-12 22:17:39 +00:00
|
|
|
sleep $S
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# mount the files or directories as requested
|
2010-09-12 22:17:39 +00:00
|
|
|
ProcessType () {
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
MOUNT=$1 # where this is (ex. /.statelite/mnt/10.2.0.200/etc/FScfg)
|
|
|
|
PATH=$2 # file (ex. /etc/FScfg)
|
|
|
|
TYPE=$3 # type of file (ex. rw)
|
|
|
|
isChild=$4 # child = 1, parent = 0
|
|
|
|
|
|
|
|
PPATH=`/usr/bin/dirname ${2}` # ex. /etc
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
case "${3}" in
|
|
|
|
rw)
|
2011-01-16 19:32:23 +00:00
|
|
|
# item is mounted from litetree dir or .default location ($1)
|
|
|
|
# onto local file
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# the local name of the file or directory
|
2011-01-16 19:32:23 +00:00
|
|
|
LOCAL=`echo ${2} | /usr/bin/sed -e 's/\/$//'`
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
if [ -d ${1} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
# if it's a dir
|
2010-09-12 22:17:39 +00:00
|
|
|
if [ ! -e ${LOCAL} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${LOCAL}
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
else
|
2011-01-16 19:32:23 +00:00
|
|
|
# if file
|
2010-09-12 22:17:39 +00:00
|
|
|
if [ ! -e ${LOCAL} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
FDIR=`/usr/bin/dirname ${2}`
|
|
|
|
/usr/bin/mkdir -m 755 -p ${FDIR}
|
|
|
|
/usr/bin/touch ${LOCAL}
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
fi
|
2011-01-16 19:32:23 +00:00
|
|
|
|
|
|
|
# ex. /.statelite/mnt/<server>/etc/lppcfg
|
|
|
|
SOURCE=`echo ${1} | /usr/bin/sed -e 's/\/$//'`
|
|
|
|
|
|
|
|
# make sure we don't get duplicate mounts
|
|
|
|
/usr/sbin/umount ${LOCAL}>>$LOG > /dev/null > /dev/null 2>&1
|
|
|
|
|
|
|
|
echo "/usr/sbin/mount ${SOURCE} ${LOCAL}" >>$LOG
|
|
|
|
/usr/sbin/mount ${SOURCE} ${LOCAL}>>$LOG 2>&1
|
2010-09-12 22:17:39 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
persistent)
|
|
|
|
# the item is copied to the /.statelite/persistent subdir
|
|
|
|
# from wherever it is found ( $1 above )
|
|
|
|
# the /.statelite/persistent/blah is then mounted
|
|
|
|
# over the local /blah
|
|
|
|
# ex. /.statelite/persistent/compute02/etc
|
|
|
|
if [ ! -d ${PERSISTENT}/${ME}${PPATH} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${PERSISTENT}/${ME}${PPATH}
|
2010-09-12 22:17:39 +00:00
|
|
|
echo "mkdir -p ${PERSISTENT}/${ME}${PPATH}" >>$LOG
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if the file doesn't exist, then copy it over to persistent
|
|
|
|
if [ ! -e ${PERSISTENT}/${ME}${2} ]; then
|
2010-10-13 16:40:26 +00:00
|
|
|
echo "cp -p -r ${1} ${PERSISTENT}/${ME}${2}" >>$LOG
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/cp -p -r ${1} ${PERSISTENT}/${ME}${2} 2>&1 >>$LOG
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
LOCAL=`echo ${2} | /usr/bin/sed -e 's/\/$//'`
|
2010-09-12 22:17:39 +00:00
|
|
|
SOURCE=`echo ${PERSISTENT}/${ME}${2}`
|
|
|
|
|
|
|
|
if [ ! -e ${LOCAL} ]; then
|
|
|
|
|
|
|
|
if [ -d ${SOURCE} ]; then
|
|
|
|
# need to create local dir
|
2010-10-13 16:40:26 +00:00
|
|
|
echo "mkdir -m 755 -p ${LOCAL}" >>$LOG
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${LOCAL}
|
2010-10-13 16:40:26 +00:00
|
|
|
|
2010-09-12 22:17:39 +00:00
|
|
|
else
|
|
|
|
# need to create local file
|
2011-01-16 19:32:23 +00:00
|
|
|
FDIR=`/usr/bin/dirname ${2}`
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${FDIR} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${FDIR}
|
2010-10-13 16:40:26 +00:00
|
|
|
fi
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/touch ${LOCAL}
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ex. mount /.statelite/persistent/<nodename>/blah /blah
|
|
|
|
# note: the dir from the statelite table is mounted over
|
|
|
|
# /.statelite/persistent
|
|
|
|
|
|
|
|
# make sure we don't get duplicate mounts
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/sbin/umount ${LOCAL}>>$LOG > /dev/null 2>&1
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
echo "/usr/sbin/mount ${SOURCE} ${LOCAL}" >>$LOG
|
|
|
|
/usr/sbin/mount ${SOURCE} ${LOCAL}>>$LOG 2>&1
|
2010-09-12 22:17:39 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
ro)
|
|
|
|
# mounted file or dir is overmounted over local version
|
|
|
|
# $1 - mounted file or directory or default(?)
|
|
|
|
# $2 - file or dir name
|
|
|
|
|
|
|
|
# ex. /etc/lppcfg
|
2011-01-16 19:32:23 +00:00
|
|
|
LOCAL=`echo ${2} | /usr/bin/sed -e 's/\/$//'`
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
# ex. /.statelite/mnt/<server>/etc/lppcfg
|
2011-01-16 19:32:23 +00:00
|
|
|
SOURCE=`echo ${1} | /usr/bin/sed -e 's/\/$//'`
|
2010-09-12 22:17:39 +00:00
|
|
|
|
|
|
|
if [ ! -e ${LOCAL} ]; then
|
|
|
|
|
|
|
|
if [ -d ${SOURCE} ]; then
|
|
|
|
# need to create local dir
|
2010-10-13 16:40:26 +00:00
|
|
|
echo "mkdir -m 755 -p ${LOCAL}" >>$LOG
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${LOCAL}
|
2010-09-12 22:17:39 +00:00
|
|
|
else
|
|
|
|
# need to create local file
|
2011-01-16 19:32:23 +00:00
|
|
|
GDIR=`/usr/bin/dirname ${2}`
|
2010-10-13 16:40:26 +00:00
|
|
|
if [ ! -d ${GDIR} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/mkdir -m 755 -p ${GDIR}
|
2010-10-13 16:40:26 +00:00
|
|
|
fi
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/bin/touch ${LOCAL}
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# make sure we don't get duplicate mounts
|
2011-01-16 19:32:23 +00:00
|
|
|
/usr/sbin/umount ${LOCAL}>>$LOG > /dev/null 2>&1
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
echo "/usr/sbin/mount -o ro ${SOURCE} ${LOCAL}" >>$LOG 2>&1
|
|
|
|
# ex. mount -o ro /.statelite/mnt/<server>/etc/lppcfg /etc/lppcfg
|
|
|
|
/usr/sbin/mount -o ro ${SOURCE} ${LOCAL}>>$LOG 2>&1
|
2010-09-12 22:17:39 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# find a source for the file or directory
|
2010-09-12 22:17:39 +00:00
|
|
|
FindFile () {
|
|
|
|
# $1 = Pathname to locate
|
|
|
|
# $2 = Type of file
|
|
|
|
# $3 = 0 or 1: 0 means parent, 1 means child
|
|
|
|
path=$1
|
|
|
|
type=$2
|
|
|
|
isChild=$3
|
|
|
|
FOUND=0
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# this assumes the dir are already in priority order in the
|
|
|
|
# /litetree.table file
|
|
|
|
for i in `/usr/bin/cat $LITETREE | /usr/bin/grep -v '^#' | /usr/bin/grep $ME`
|
2010-09-12 22:17:39 +00:00
|
|
|
do
|
2011-01-16 19:32:23 +00:00
|
|
|
SERVER=`echo $i | /usr/bin/awk -F'|' '{print $2}'`
|
|
|
|
DIR=`echo $i | /usr/bin/awk -F'|' '{print $3}'`
|
|
|
|
SRC=`echo ${MOUNTDIR}/${SERVER}${DIR}${path} | /usr/bin/sed -e 's/\/\//\//'`
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# ex. SRC = /.statelite/mnt/10.2.0.200/etc/FScfg
|
|
|
|
# or /.statelite/mnt/10.2.0.200/root/ssh/
|
2010-09-12 22:17:39 +00:00
|
|
|
if [ -e ${SRC} ]; then
|
2011-01-16 19:32:23 +00:00
|
|
|
# ok - we found a src for the file or dir
|
|
|
|
PATHEND=${#path}
|
|
|
|
CHAREND=`echo ${path} | /usr/bin/cut -c${PATHEND}`
|
2010-10-15 11:26:08 +00:00
|
|
|
if [ "${CHAREND}" != '/' ] && [ -d ${SRC} ]; then
|
2010-10-15 08:34:00 +00:00
|
|
|
FOUND=0
|
|
|
|
continue
|
|
|
|
fi
|
2010-09-12 22:17:39 +00:00
|
|
|
|
2010-10-15 09:50:34 +00:00
|
|
|
if [ "${CHAREND}" = "/" ] && [ -f ${SRC} ]; then
|
2010-10-15 08:34:00 +00:00
|
|
|
FOUND=0
|
|
|
|
continue
|
|
|
|
fi
|
2011-01-16 19:32:23 +00:00
|
|
|
|
|
|
|
FOUND=1
|
|
|
|
ProcessType ${SRC} ${path} ${type} ${isChild}
|
|
|
|
break
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2011-01-16 19:32:23 +00:00
|
|
|
# couldn't find SRC so use the value in /.default
|
2010-09-12 22:17:39 +00:00
|
|
|
# Default behavior is to get from the image
|
|
|
|
if [ "$FOUND" = "0" ]; then
|
|
|
|
if [ -e "${DEFAULT}${path}" ]; then
|
|
|
|
ProcessType ${DEFAULT}${path} ${path} ${type} ${isChild}
|
|
|
|
else
|
2011-01-16 19:32:23 +00:00
|
|
|
echo "Could not find ${path}" >>$LOG
|
2010-09-12 22:17:39 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# Start / MAIN / main
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
# mount the persistent dir - if provided
|
|
|
|
ProcessStatelite
|
|
|
|
|
|
|
|
# mount all the dirs from the litetree table.
|
|
|
|
MountTrees
|
|
|
|
|
|
|
|
# process the litefile table
|
|
|
|
ProcessLitefile
|
|
|
|
|
|
|
|
exit 0
|