/----------------------------------------------------------------------------\
|                                                                            |
|                        The Poor Man's Mirror Script                        |
|                                                                            |
+----------------------------------------------------------------------------+
|                                                                            |
|                        tpircS rorriM s'naM rooP ehT                        |
|                                                                            |
\----------------------------------------------------------------------------/


Introduction
   I am announcing the availability of a couple of smallish perl scripts that
   can  be  used  to  maintain  an  up  to date copy of any archive directory
   structure that is available from a UNIX host  via  anonymous  ftp.   These
   scripts  can  be  used to maintain an archive on your PC even if your only
   internet connection is via a dial-up UNIX shell  account.   These  scripts
   are  particularly  useful for ftp'ing a Linux distribution from one of the
   mirror sights and modeming it down to your PC.  If you choose to  do this,
   please do so during off peak hours for the archive site.


History
   About a year ago, I had heard and read much about Linux, but had never got
   around  to  installing  it to see what it was really about.  After the 1.0
   version of the kernel was released, I decided it  was  time.   Back  then,
   CD's  weren't  as  popular as they are now, and I didn't (and still don't)
   have a CD-ROM drive.  Since I had internet access through work, I  decided
   to  pull  the Slackware distribution down to a UNIX machine there and then
   push it  down  to my PC using ZMODEM.  I started the process manually, but
   eventually  broke  down  and  hacked together five or so awk(1) and csh(1)
   scripts to automate most of the process.  Within a few days, I was up  and
   running Linux.

   Since several of my friends were interested in Linux, and since I had some
   free disk space, I thought it would be nice to keep the distribution on my
   hard drive.  A month or so down the road, Patrick Volkerding made  massive
   updates to Slackware, and my archive was out of date.  At the same time, I
   was starting to learn perl.  I decided it might be fun to  throw  away  my
   awk(1) and csh(1) scripts and write a perl script that I could use to keep
   my archive up to date.  The scrip would work like a Makefile in the  sense
   that  it  would  only  download  a file if it was new or if it had changed
   since the last download.

   The script had to actually  be  two  scripts  because  two  machines  were
   involved,  the  UNIX  machine  at  my  work and my Linux PC at home.   The
   script at home would take  a  recursive  directory  listing  of  my  linux
   archive  and up-load that to the script at work.  The script at work would
   get a recursive directory listing of the Slackware  distribution  from  an
   ftp.cdrom.com  mirror  site and compare that listing with the listing from
   home.  It would create a list of files in my archive  at  home  that  were
   obsolete  and  a list of files that needed to be added or updated from the
   mirror site.  Then it would ftp the files and ZMODEM them one by one  down
   to  my  PC.  The script at home would make space for the new files and, as
   each file finished downloading, it would move  the  file  to  its   proper
   location in my archive.  Writing the script was quite an experience, and I
   learned a lot about perl programming in the process.

   I imagined that I might not be the only person interested  in  doing  this
   sort  of thing, so I made my scripts available at sunsite.unc.edu and tsx-
   11.mit.edu as well as in the ftp directory provided my Netcom, my  current
   internet  service  provider.   Unfortunately, I unknowingly chose the same
   name for my archive as Lee McLoughlin chose for his.   Lee's  scripts  are
   the  ones  that most ftp sites use to keep the archives that they "mirror"
   from other sites in sync.  I've seen his scripts and they are much fancier
   than  what  I  have cobbled together, so I had to come up with a new name.
   The name I chose was pmirror, which stands for  "Poor  Man's  Mirror".   I
   chose  this  name  because  my  scripts  are  much  smaller  and easier to
   understand, and they don't do nearly as much as the original.


Features
   - The remote script (the one that runs on the PC at home) works under
     Linux or under DOS.  This is handy if you don't already have Linux,
     but would like to pull a distribution down to your PC to install it.

   - The pmirror script forks itself so that it can ftp files in the
     background and download them in the foreground.  This results in a
     significant time savings over ftp'ing and downloading in serial.

   - If interrupted, the process can be re-started without much
     backtracking.  Just run 'remote -c -p 1' on your PC and then start
     again with 'remote -i'.  Because the process works like a "Makefile",
     the files that were downloaded up to the point of interruption will
     not (normally) be downloaded again after when you re-start.


Where To Get "The Poor Man's Mirror Script"
   See the pmirror*.lsm file  for  details.   Archives  of  the  scripts  are
   generally  available  on  tsx-11.mit.edu mirrors, sunsite.unc.edu mirrors,
   and from ftp.netcom.com.  The UNIX archive will be named  pmirror-*.tar.gz
   and the DOS archive will be named pmirror-*.zip.

   If you don't have ftp access of some kind, these scripts probably won't be
   of  much  use  to  you.   If you would like to have them anyway, send me a
   request via e-mail, and I'll be glad to send them to you.

-- David
   dsnyder@netcom.com
