Package: mirrors
Severity: wishlist
Tags: patch

The anonftpsync program does not take arguments,
it must be edited to be used.  This is annoying
when it comes to mirroring more than one archive.
(e.g. the regular debian archive and volatile.debian.org,
or whatever.)

Attached is a patch that fixes this problem.  It does
so in the most painless way possible -- necessary variables
are taken from the environment when they exist.

This allows arguments to be passed to anonftpsync
by setting environment variables on the command line, like:

  RSYNC_HOST=rsync.debian.example.com /usr/local/bin/anonftpsync

Note that this patch is expected to be applied after the
bandwidth limit patch of Bug#441460.

See also Debian bug #363349, which complains about this
and more.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
--- anonftpsync 2007-09-09 18:28:21.000000000 -0500
+++ anonftpsync3        2007-09-09 18:48:53.000000000 -0500
@@ -15,28 +15,35 @@
 # Set the variables below to fit your site. You can then use cron to have
 # this script run daily to automatically update your copy of the archive.
 
+# Variables may be set by editing this file or may be obtained
+# from the shell environment, e.g.:
+# $ TO=/srv/debianmirror RSYNC_HOST=rsync.debian.example.com \
+#     LOGDIR=/srv/debianlogs /usr/local/bin/anonftpsync
+# Variables set in the environment have priority over variables
+# set in code below.
+
 # TO is the destination for the base of the Debian mirror directory
 # (the dir that holds dists/ and ls-lR).
 # (mandatory)
 
-TO=
+[ -n "$TO" ] || TO=
 
 # RSYNC_HOST is the site you have chosen from the mirrors file.
 # (http://www.debian.org/mirror/list-full)
 # (mandatory)
 
-RSYNC_HOST=
+[ -n "$RSYNC_HOST" ] || RSYNC_HOST=
 
 # RSYNC_DIR is the directory given in the "Packages over rsync:" line of
 # the mirrors file for the site you have chosen to mirror.
 # (mandatory)
 
-RSYNC_DIR=debian/
+[ -n "$RSYNC_DIR" ] || RSYNC_DIR=debian/
 
 # LOGDIR is the directory where the logs will be written to
 # (mandatory)
 
-LOGDIR=
+[ -n "$LOGDIR" ] || LOGDIR=
 
 # ARCH_EXCLUDE can be used to exclude a complete architecture from
 # mirrorring. Please use as space seperated list.
@@ -52,7 +59,7 @@
 # With a blank ARCH_EXCLUDE you will mirror all available architectures
 # (optional)
 
-ARCH_EXCLUDE=
+[ -n "$ARCH_EXCLUDE" ] || ARCH_EXCLUDE=
 
 # EXCLUDE is a list of parameters listing patterns that rsync will exclude, in
 # addition to the architectures excluded by ARCH_EXCLUDE.
@@ -74,19 +81,19 @@
 # architectures excluded by ARCH_EXCLUDE.
 # (optional)
 
-EXCLUDE=
+[ -n "$EXCLUDE" ] || EXCLUDE=
 
 # MAILTO is the address to send logfiles to;
 # if it is not defined, no mail will be sent
 # (optional)
 
-MAILTO=
+[ -n "$MAILTO" ] || MAILTO=
 
 # BWLIMIT Bandwidth limit in KBps.  Defaults to '' (unlimited).
 # Limit the maximum transfer rate to the given number of kilobits per
 # second via the rsync --bwlimit parameter.
 
-BWLIMIT=
+[ -n "$BWLIMIT" ] || BWLIMIT=
 
 # LOCK_TIMEOUT Timeout in minutes.  Defaults to 360 (6 hours).
 # This program creates a lock to ensure that only one copy
@@ -94,7 +101,7 @@
 # Locks held for longer than the timeout are broken, unless
 # a running rsync process appears to be connected to $RSYNC_HOST.
 
-LOCK_TIMEOUT=360
+[ -n "$LOCK_TIMEOUT" ] || LOCK_TIMEOUT=360
 
 # There should be no need to edit anything below this point, unless there
 # are problems.

Reply via email to