5250 |
18 Jan 19 |
nicklas |
#!/bin/sh |
5250 |
18 Jan 19 |
nicklas |
2 |
# |
5250 |
18 Jan 19 |
nicklas |
# Usage: ./rsync.sh [RELEASEARCHIVE] [LEVEL3DIR] |
5250 |
18 Jan 19 |
nicklas |
# Sync files from RELEASEARCHIVE to LEVEL3DIR |
5250 |
18 Jan 19 |
nicklas |
# A RELEASEARCHIVE location must be specified and should point |
5250 |
18 Jan 19 |
nicklas |
# to the directory in the release archive that corresponds the |
5250 |
18 Jan 19 |
nicklas |
# current version. The default value is taken from the ReleaseArchive |
5250 |
18 Jan 19 |
nicklas |
# item in BASE. |
5250 |
18 Jan 19 |
nicklas |
# 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 |
# Syncs a single file from PROJECTARCHIVE to RELEASEPATH |
5250 |
18 Jan 19 |
nicklas |
# $1 = The source file |
5250 |
18 Jan 19 |
nicklas |
# $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 |