Bug#441461: mirrors: anonftpsync does not take arguments, it must be edited to be used

2007-09-12 Thread Josip Rodin
On Sun, Sep 09, 2007 at 07:25:37PM -0500, Karl O. Pinc wrote:
 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.

Now, this is technically all right, but it touches on the issue of
having the script be configured from the same file. The added visual
complexity of having variables tested for existence before setting
makes the upper section unsuitable for newbies. On the other hand,
it was never defined exactly how non-newbie does one have to be to use it.
At the same time, anonftpsync was never intended to be the end-all
solution to all of people's mirroring needs - after all, it's just
a shell script :)

I suppose that the next step in the life of anonftpsync would be to move
the configuration out of the script and into a separate file, and then the
script wouldn't have to be too readable. At the same time, that would make
it a notch harder to upgrade. That would be a good time to rename it,
since it hasn't been using anonymous FTP for decades now :)

-- 
Josip Rodin
[EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#441461: mirrors: anonftpsync does not take arguments, it must be edited to be used

2007-09-12 Thread Karl O. Pinc


On 09/12/2007 10:36:56 AM, Josip Rodin wrote:

On Sun, Sep 09, 2007 at 07:25:37PM -0500, Karl O. Pinc wrote:



 The anonftpsync program does not take arguments,



 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.



I suppose that the next step in the life of anonftpsync would be to
move
the configuration out of the script and into a separate file, and then
the
script wouldn't have to be too readable.


Yes, and at this point dead easy, because all you'd have to do
would be to source the config file in anonftpsync.

 At the same time, that would

make
it a notch harder to upgrade.


Yeah. Another argument for packaging the program.

 That would be a good time to rename it,

since it hasn't been using anonymous FTP for decades now :)


:)


Karl [EMAIL PROTECTED]
Free Software:  You don't pay back, you pay forward.
 -- Robert A. Heinlein




Bug#441461: mirrors: anonftpsync does not take arguments, it must be edited to be used

2007-09-09 Thread Karl O. Pinc
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.0 -0500
+++ anonftpsync32007-09-09 18:48:53.0 -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.