summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Paskevich <eugene@raptor.kiev.ua>2014-05-06 22:09:03 +0300
committerJoerg Jaspert <joerg@debian.org>2014-05-08 10:42:52 +0200
commit26df6757ada617f423f653e114cfacfe40e607cd (patch)
treefbef804fad7b48afcbe66d8a598b7a27800b8734
parent9a34477b2a53e0a634db111095139b568ff3898a (diff)
Revised trace file generation a bit.
- Added an option to write the date only. - Added an option to change the hostname written into the trace file. - Open the new temporary trace file for writing only once.
-rwxr-xr-xbin/ftpsync43
-rw-r--r--etc/ftpsync.conf.sample8
2 files changed, 30 insertions, 21 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index c30563a..0aa7a17 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -281,7 +281,8 @@ TRACE=${TRACE:-"project/trace/${MIRRORNAME}"}
# what it will be.
# Possible values are
# "full" - all information
-# "terse" - basic, timestamp only (date -u)
+# "terse" - partial, ftpsync version and local hostname
+# "date" - basic, timestamp only (date -u)
# "touch" - just touch the file in existance
# "none" - no tracefile at all
#
@@ -608,26 +609,30 @@ if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then
log "Just touching the trace file"
touch "${TO}/${TRACE}"
;;
- terse|full)
+ date|terse|full)
log "Creating a ${EXTENDEDTRACE} trace file"
if [ -d "$(dirname "${TO}/${TRACE}")" ]; then
- LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}.new"
- echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}.new"
- echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}.new"
- 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}.new"
- echo "Upstream-mirror: ${RSYNC_HOST}" >> "${TO}/${TRACE}.new"
- fi # full trace
+ {
+ LC_ALL=POSIX LANG=POSIX date -u
+ if [ "xdatex" != "x${EXTENDEDTRACE}x" ]; then
+ echo "Used ftpsync version: ${VERSION}"
+ echo "Running on host: ${TRACEHOST:-$(hostname -f)}"
+ 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}"
+ echo "Upstream-mirror: ${RSYNC_HOST}"
+ fi # full trace
+ fi # other traces
+ } > "${TO}/${TRACE}.new"
mv "${TO}/${TRACE}.new" "${TO}/${TRACE}"
fi
;;
diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample
index c8750fe..6258c57 100644
--- a/etc/ftpsync.conf.sample
+++ b/etc/ftpsync.conf.sample
@@ -6,7 +6,7 @@
########################################################################
########################################################################
-## Mirrorname. This is used for things like the trace file and should always
+## Mirrorname. This is used for things like the trace file name and should always
## be the full hostname of the mirror.
#MIRRORNAME=`hostname -f`
@@ -108,13 +108,17 @@
## what it will be.
## Possible values are
## "full" - all information
-## "terse" - basic, timestamp only (date -u)
+## "terse" - partial, ftpsync version and local hostname
+## "date" - 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"
+## The local hostname to be written to the trace file.
+#TRACEHOST="$(hostname -f)"
+
## We sync our mirror using rsync (everything else would be insane), so
## we need a few options set.
## The rsync program