projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
several fixes
[mirror/dsa-puppet.git]
/
modules
/
roles
/
files
/
static-mirroring
/
static-mirror-run
diff --git
a/modules/roles/files/static-mirroring/static-mirror-run
b/modules/roles/files/static-mirroring/static-mirror-run
index
bdcc928
..
0f7bc14
100755
(executable)
--- a/
modules/roles/files/static-mirroring/static-mirror-run
+++ b/
modules/roles/files/static-mirroring/static-mirror-run
@@
-1,6
+1,6
@@
#!/bin/bash
#!/bin/bash
-# initiate a
mirror staged mirror update from sync-source
.
+# initiate a
staged mirror update from sync-source for a component
.
#
# if we have a serial file and we got a serial on the command line, only sync if the serial is different
#
# if we have a serial file and we got a serial on the command line, only sync if the serial is different
@@
-64,7
+64,7
@@
if [ -z "$BASEDIR" ]; then usage >&2; exit 1; fi
if [ -z "$SYNC_SOURCE" ]; then usage >&2; exit 1; fi
RSYNC="rsync"
if [ -z "$SYNC_SOURCE" ]; then usage >&2; exit 1; fi
RSYNC="rsync"
-RSYNC_BASE_OPTIONS="-
avz --delete
"
+RSYNC_BASE_OPTIONS="-
rtvz --delete --links --hard-links --safe-links
"
RSYNC_SSH_OPTIONS="ssh -o AddressFamily=inet -o BatchMode=yes"
LOGDIR="$HOME/logs"
RSYNC_SSH_OPTIONS="ssh -o AddressFamily=inet -o BatchMode=yes"
LOGDIR="$HOME/logs"
@@
-106,6
+106,7
@@
log() {
}
lock() {
}
lock() {
+ mkdir -p "$BASEDIR"
exec 200< "$BASEDIR"
if ! flock -e 200; then
log "Cannot acquire lock."
exec 200< "$BASEDIR"
if ! flock -e 200; then
log "Cannot acquire lock."
@@
-119,13
+120,15
@@
lock() {
log_setup
log_setup
-#log "called with $* and ${SSH_ORIGINAL_COMMAND:-no ssh original command options}."
log "called with $*"
lock
if [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$ALPHA" ] ; then
staging="$BRAVO"
active="$ALPHA"
log "called with $*"
lock
if [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$ALPHA" ] ; then
staging="$BRAVO"
active="$ALPHA"
+elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" != "$BRAVO" ] ; then
+ echo >&5 "Invalid state of ${BASEDIR}${ACTIVE}."
+ exit 1
else
staging="$ALPHA"
active="$BRAVO"
else
staging="$ALPHA"
active="$BRAVO"