Rsync script to mirror i386-only Debian on local network -- SOHO
Hi, I was looking for a good script to make an i386-only SOHO mirror
of Debian and since there are so few around, here's mine:
#! /bin/sh
#
# Copyright 2004 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
#
# 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 binary-${1}/ --exclude *_${1}.deb --exclude
*_${1}.changes --exclude Contents-${1}.gz --exclude disks-${1}/
--exclude *_${1}.udeb --exclude installer-${1}/ "
shift
done
return 0
}
exclude_source ()
{
case "$EXCLUDE_SOURCE" in
"y*" | "Y*") echo -n "--exclude source/ --exclude *.orig.tar.gz
--exclude *.diff.gz --exclude *.dsc" ;;
esac
}
do_mirror ()
{
_rsync_host=$1
_target_dir=$2
rsync -aPS --delete-after \
`exclude_arch $EXCLUDE_ARCH` \
`exclude_source` \
$EXCLUDE_OTHER \
${_rsync_host} ${_target_dir}
return 0
}
# ---------------------------------------------------------------
# Customize this section
# Things to exclude.
# With blank EXCLUDE_* you will mirror the entire archive.
# This sample would exclude all architectures:
# EXCLUDE_ARCH="alpha arm m68k mips mipsel powerpc sparc i386 ia64
hppa sh s390 hurd-i386"
EXCLUDE_ARCH="alpha arm m68k mips mipsel powerpc sparc ia64 hppa sh
s390 hurd-i386"
#EXCLUDE_ARCH=
# This sample would exclude the source code:
EXCLUDE_SOURCE="y"
#EXCLUDE_SOURCE="n"
# Exclude other things, like some symlinks or sections.
# The --exclude option must be given in this case.
# Samples:
# EXCLUDE_OTHER="--exclude stable/ --exclude testing/ --exclude
unstable/"
# EXCLUDE_OTHER="--exclude /contrib/ --exclude /non-free/"
#
# Exclude old distributions. Note that this won't work well for newer
# ones which have their files in a pool directory.
EXCLUDE_OTHER="--exclude /slink/ --exclude /slink-proposed-updates/"
EXCLUDE_OTHER="--exclude /potato/ --exclude
/poatato-proposed-updates/"
#EXCLUDE_OTHER=
# 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: