extensions/net.sf.basedb.relax/trunk/src/net/sf/basedb/relax/bash/rsync-template.sh

Code
Comments
Other
Rev Date Author Line
5250 18 Jan 19 nicklas 1 #!/bin/sh
5250 18 Jan 19 nicklas 2
5250 18 Jan 19 nicklas 3 # Usage: ./rsync.sh [RELEASEARCHIVE] [LEVEL3DIR]
5250 18 Jan 19 nicklas 4 # Sync files from RELEASEARCHIVE to LEVEL3DIR
5250 18 Jan 19 nicklas 5 # A RELEASEARCHIVE location must be specified and should point
5250 18 Jan 19 nicklas 6 # to the directory in the release archive that corresponds the 
5250 18 Jan 19 nicklas 7 # current version. The default value is taken from the ReleaseArchive
5250 18 Jan 19 nicklas 8 # item in BASE.
5250 18 Jan 19 nicklas 9 # The current directory is the default LEVEL3DIR directory
5250 18 Jan 19 nicklas 10
5250 18 Jan 19 nicklas 11
5250 18 Jan 19 nicklas 12 <<RELEASEINFO>>
5250 18 Jan 19 nicklas 13
5250 18 Jan 19 nicklas 14 set -e
5250 18 Jan 19 nicklas 15
5250 18 Jan 19 nicklas 16 RELEASEARCHIVE=${1-<<DEFAULTRELEASEARCHIVE>>}
5250 18 Jan 19 nicklas 17 LEVEL3DIR=${2-.}
5250 18 Jan 19 nicklas 18
5250 18 Jan 19 nicklas 19 RSYNCOPTIONS="<<RSYNCOPTIONS>>"
5250 18 Jan 19 nicklas 20 NUMFILES=<<NUMFILES>>
5250 18 Jan 19 nicklas 21 NSYNCED=0
5250 18 Jan 19 nicklas 22
5250 18 Jan 19 nicklas 23 echo "Syncing ${NUMFILES} files from '${RELEASEARCHIVE}' to '${LEVEL3DIR}'"
5250 18 Jan 19 nicklas 24
5250 18 Jan 19 nicklas 25 # Syncs a single file from PROJECTARCHIVE to RELEASEPATH
5250 18 Jan 19 nicklas 26 # $1 = The source file
5250 18 Jan 19 nicklas 27 # $2 = The destination file
5250 18 Jan 19 nicklas 28 function syncFile {
5250 18 Jan 19 nicklas 29   NSYNCED=$(( ${NSYNCED} + 1 ))
5250 18 Jan 19 nicklas 30   echo "[${NSYNCED}/${NUMFILES}] ${LEVEL3DIR}$2"
5250 18 Jan 19 nicklas 31   rsync ${RSYNCOPTIONS} ${RELEASEARCHIVE}$1 ${LEVEL3DIR}$2
5250 18 Jan 19 nicklas 32 }
5250 18 Jan 19 nicklas 33
5250 18 Jan 19 nicklas 34 <<SCRIPT>>
5250 18 Jan 19 nicklas 35
5250 18 Jan 19 nicklas 36 echo Done: ${NSYNCED} files have been synced