0b517b5801
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13291 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# This script is used by the xdcp APPEND: function to perform the
|
|
# append operation on the nodes.
|
|
#First parm is nodesyncfiledir, then after that are the lines for the
|
|
#APPEND clause put in the format
|
|
#appendfile1:orgfile1 appendfile2:orgfile2.....
|
|
#
|
|
nodesyncfiledir=$1
|
|
nodesyncfiledirorg="$nodesyncfiledir/org"
|
|
nodesyncfiledirappend="$nodesyncfiledir/append"
|
|
skip=0
|
|
for i in $*; do
|
|
# skip first parm
|
|
if [ $skip -eq 0 ]; then
|
|
skip=1
|
|
continue
|
|
fi
|
|
# get the append file location
|
|
appendfilebase=`echo "$i"|cut -d ':' -f 1`
|
|
appendfile="$nodesyncfiledirappend$appendfilebase"
|
|
# get the file to append to
|
|
orgfile=`echo "$i"|cut -d ':' -f 2`
|
|
# get the directory to backup the original file to append
|
|
orgfiledir=`dirname $orgfile`
|
|
filebackupdir="$nodesyncfiledirorg$orgfiledir"
|
|
filebackup="$nodesyncfiledirorg$orgfile"
|
|
# now do the work
|
|
mkdir -p $filebackupdir
|
|
if [ ! -f "$filebackup" ]; then
|
|
cp -p $orgfile $filebackup
|
|
fi
|
|
cp -p $filebackup $orgfile
|
|
cat $appendfile >> $orgfile
|
|
|
|
done
|
|
exit 0
|