summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2012-05-18 21:27:02 +0200
committerJoerg Jaspert <joerg@debian.org>2012-05-18 21:27:02 +0200
commit2511ccec9bfab0c984f631d736963ab77c714c14 (patch)
treea164a2e4844c564985e6b35d81f361a4a3e10de9
parent97900f01fdb41b7fa97a7ec0419a7c84b2db0d9d (diff)
* bin/ftpsync: Added EXTENDEDTRACE option
one can now select to have no tracefile, just to touch a file, terse or full format. For Debian mirrors it has to be full. Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/ftpsync61
-rw-r--r--etc/ftpsync.conf.sample11
2 files changed, 55 insertions, 17 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 14824e9..20af095 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}
@@ -522,25 +532,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..a311b77 100644
--- a/etc/ftpsync.conf.sample
+++ b/etc/ftpsync.conf.sample
@@ -95,6 +95,17 @@
## 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