From ce1c8ff35af919fe42a4ec86168773adb3593e65 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 15 Jun 2012 15:43:55 +0000 Subject: [PATCH] checking in code for APPEND, still needs testing do not try git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13110 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/scripts/xdcpappend.sh | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 xCAT-server/share/xcat/scripts/xdcpappend.sh diff --git a/xCAT-server/share/xcat/scripts/xdcpappend.sh b/xCAT-server/share/xcat/scripts/xdcpappend.sh new file mode 100755 index 000000000..e03c6c93d --- /dev/null +++ b/xCAT-server/share/xcat/scripts/xdcpappend.sh @@ -0,0 +1,36 @@ +#!/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 +#appendfile appendfile:orgfile 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