summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ftpsync67
-rw-r--r--etc/ftpsync.conf.sample27
2 files changed, 73 insertions, 21 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 2fc310d..b8020e3 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -272,6 +272,16 @@ LOCKTIMEOUT=${LOCKTIMEOUT:-3600}
UPDATEREQUIRED="${TO}/Archive-Update-Required-${MIRRORNAME}"
# Trace file for mirror stats and checks (make sure we get full hostname)
TRACE=${TRACE:-"project/trace/${MIRRORNAME}"}
+# The trace file can have different format/contents. Here you can select
+# what it will be.
+# Possible values are
+# "full" - all information
+# "terse" - basic, timestamp only (date -u)
+# "touch" - just touch the file in existance
+# "none" - no tracefile at all
+#
+# Default and required value for Debian mirrors is full.
+EXTENDEDTRACE=${EXTENDEDTRACE:-"full"}
# rsync program
RSYNC=${RSYNC:-rsync}
@@ -289,9 +299,13 @@ RSYNC_OPTIONS2=${RSYNC_OPTIONS2:-"--max-delete=40000 --delay-updates --delete --
# Which rsync share to use on our upstream mirror?
RSYNC_PATH=${RSYNC_PATH:-"debian"}
+# Extra rsync options as defined by the admin locally. Won't be set
+# to any default by ftpsync. Those will be added to EACH AND EVERY rsync call.
+RSYNC_EXTRA=${RSYNC_EXTRA:-""}
+
# Now add the bwlimit option. As default is 0 we always add it, rsync interprets
# 0 as unlimited, so this is safe.
-RSYNC_OPTIONS="--bwlimit=${RSYNC_BW} ${RSYNC_OPTIONS}"
+RSYNC_OPTIONS="${RSYNC_EXTRA} --bwlimit=${RSYNC_BW} ${RSYNC_OPTIONS}"
# We have no default host to sync from, but will error out if its unset
RSYNC_HOST=${RSYNC_HOST:-""}
@@ -522,25 +536,42 @@ done
# We only update our tracefile when we had a stage2 or an all sync.
# Otherwise we would update it after stage1 already, which is wrong.
+
if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then
- if [ -d "$(dirname "${TO}/${TRACE}")" ]; then
- LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}"
- echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}"
- echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}"
-
- GLOBALARCHLIST="source amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc"
-
- AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$"
- ARCHLIST=""
- for ARCH in ${GLOBALARCHLIST}; do
- if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then
- ARCHLIST="${ARCHLIST} ${ARCH}"
+ case ${EXTENDEDTRACE} in
+ none)
+ log "No trace file wanted. Not creating one"
+ ;;
+ touch)
+ log "Just touching the trace file"
+ touch "${TO}/${TRACE}"
+ ;;
+ terse|full)
+ log "Creating a ${EXTENDEDTRACE trace file"
+ if [ -d "$(dirname "${TO}/${TRACE}")" ]; then
+ LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}"
+ echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}"
+ echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}"
+ if [ "xfullx" = "x${EXTENDEDTRACE}x" ]; then
+ GLOBALARCHLIST="source amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc"
+
+ AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$"
+ ARCHLIST=""
+ for ARCH in ${GLOBALARCHLIST}; do
+ if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then
+ ARCHLIST="${ARCHLIST} ${ARCH}"
+ fi
+ done
+ out="GUESSED:{${ARCHLIST}}"
+ echo "Architectures: ${out}" >> "${TO}/${TRACE}"
+ echo "Upstream-mirror: ${RSYNC_HOST}" >> "${TO}/${TRACE}"
+ fi # full trace
fi
- done
- out="GUESSED:{${ARCHLIST}}"
- echo "Architectures: ${out}" >> "${TO}/${TRACE}"
- echo "Upstream-mirror: ${RSYNC_HOST}" >> "${TO}/${TRACE}"
- fi
+ ;;
+ *)
+ error "Unsupported EXTENDEDTRACE value configured in ${BASEDIR}/etc/${NAME}.conf, please fix"
+ ;;
+ esac
fi
diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample
index 7d915e0..6b16cc8 100644
--- a/etc/ftpsync.conf.sample
+++ b/etc/ftpsync.conf.sample
@@ -95,19 +95,40 @@
## This is *relative* to ${TO}
#TRACE="project/trace/${MIRRORNAME}"
+## The trace file can have different format/contents. Here you can select
+## what it will be.
+## Possible values are
+## "full" - all information
+## "terse" - basic, timestamp only (date -u)
+## "touch" - just touch the file in existance
+## "none" - no tracefile at all
+##
+## Default and required value for Debian mirrors is full.
+#EXTENDEDTRACE="full"
+
## We sync our mirror using rsync (everything else would be insane), so
## we need a few options set.
## The rsync program
#RSYNC=rsync
+## Extra rsync options as defined by the local admin.
+## There is no default by ftpsync.
+##
+## Please note that these options are added to EVERY rsync call.
+## Also note that these are added at the beginning of the rsync call, as
+## the very first set of options.
+## Please ensure you do not add a conflict with the usual rsync options as
+## shown below.
+# RSYNC_EXTRA=""
+
+## limit I/O bandwidth. Value is KBytes per second, unset or 0 means unlimited
+#RSYNC_BW=""
+
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
-## limit I/O bandwidth. Value is KBytes per second, unset or 0 means unlimited
-#RSYNC_BW=""
-
## Default rsync options every rsync invocation sees.
#RSYNC_OPTIONS="-prltvHSB8192 --timeout 3600 --stats --exclude Archive-Update-in-Progress-${MIRRORNAME} --exclude ${TRACE} --exclude Archive-Update-Required-${MIRRORNAME}"