[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Rsync script to mirror Debian based on anonftpsync



I find this script useful on small LAN's, etc.:


#! /bin/sh
#
# Copyright 2004  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
#
# UPDATED by Chris Rainey <marin_linuxer@yahoo.com>
#
# This file is distributed under the terms of the GNU General Public
# License, Version 2, as published at http://www.gnu.org/licenses/gpl.html
#
# This script originates from http://www.debian.org/mirror/anonftpsync
#
# Note: You MUST have rsync 2.0.16-1 or newer, which is available in
# slink and all newer Debian releases, or at http://rsync.samba.org/
#
# Set the variables at the end of the file to fit your site. You can
# then use cron to have this script run daily to automatically update your copy
# of the archive.
#
# Don't forget:
# chmod 744 anonftpsync

# ---------------------------------------------------------------------------
# There should be no need to edit anything in this section, unless
# there are problems. See the end of the file for customization.
set -e

exclude_arch ()
{
 while [ $# -ge 1 ]; do
  echo -n "--exclude *-${1}* --exclude *_${1}* --exclude *{1}.* "
  shift
 done
 return 0
}

do_mirror ()
{
 _rsync_host=$1
 _target_dir=$2

 rsync -aPS --delete-after --delete-excluded --exclude source/ \
  --exclude *.tar.gz* --exclude *.diff* --exclude *.dsc* \
  `exclude_arch $EXCLUDE_ARCH` \
  ${_rsync_host} ${_target_dir} 

 return 0
}

# ---------------------------------------------------------------
# Customize this section

# This sample would exclude all architectures:
# EXCLUDE_ARCH="alpha amd64 amiga atari arm bvme6000 hppa hurd-i386 \
#  i386 ia64 m68k mac mips mipsel mvme netbsd-i386 netbsd-alpha netwinder \
#  powerpc riscpc s390 sh sparc"
#
 EXCLUDE_ARCH="alpha amd64 amiga arm atari bvme6000 hppa hurd-i386 \
  ia64 m68k mac mips mipsel mvme netbsd-i386 netbsd-alpha netwinder \
  powerpc riscpc s390 sh sparc"

# Trees to mirror
#
 do_mirror rsync://debian.fastweb.it/debian/ \
  /mnt/hd/debian-mirror/debian
 do_mirror rsync://debian.fastweb.it/debian-non-US/ \
  /mnt/hd/debian-mirror/debian-non-US

# End of customize section
# ---------------------------------------------------------------
exit 0



Reply to: