diff options
author | Colin Watson <cjwatson@debian.org> | 2004-01-24 17:17:24 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2004-01-24 17:17:24 +0000 |
commit | b4a05fa59ad01decb017ab653373815e84307d07 (patch) | |
tree | e36c73e4dde8156f4823c19ccd404fe8be0fbedd /examples | |
parent | 85937e404b5837c132c63625ddf63a54cbf6051d (diff) |
madison-lite: Add an example script to build a local index-only mirror.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/make-local-mirror | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/examples/make-local-mirror b/examples/make-local-mirror new file mode 100755 index 0000000..6d80ee9 --- /dev/null +++ b/examples/make-local-mirror @@ -0,0 +1,86 @@ +#! /bin/sh -e + +# This is an example of how to build a local mirror containing only the +# index files, not the packages themselves. If you put something similar to +# this in a cron job, then you can run madison-lite locally. Be sure to +# change the various hostnames to appropriate mirrors, set MIRROR to a +# suitable directory, and fill the mirror directory into your madison-lite +# configuration file. +# +# If you are reading this after the release of sarge, then you may need to +# change the lists of distributions and architectures. + +HOST_MAIN=${HOST_MAIN:-'ftp://ftp.debian.org/debian'} +HOST_NONUS=${HOST_NONUS:-'ftp://non-us.debian.org/debian-non-US'} +HOST_SECURITY=${HOST_SECURITY:-'ftp://security.debian.org/debian-security'} +MIRROR=${MIRROR:-/tmp/mirror} + +WGET_OPTS=${WGET_OPTS-'-q -N --passive-ftp'} + +umask 002 + +mkdir -p "$MIRROR" +cd "$MIRROR" + +mkdir -p dists +cd dists + +archives='main non-US security' +components='main contrib non-free' + +for archive in $archives; do + case $archive in + main) + host="$HOST_MAIN" + suitesuffix='' + suites='stable testing unstable experimental' + ;; + non-US) + host="$HOST_NONUS" + suitesuffix='/non-US' + suites='stable testing unstable' + ;; + security) + host="$HOST_SECURITY" + suitesuffix='/updates' + suites='stable testing' + ;; + *) + echo "Internal error: archive '$archive'?" >&2 + exit 1 + esac + + for suite in $suites; do + if [ "$archive" = main ]; then + suitehere="$suite" + else + suitehere="$suite-$archive" + fi + + mkdir -p "$suitehere" + if [ "$suite" = experimental ]; then + root=project + else + root=dists + fi + case $suite in + oldstable) + arches='alpha arm i386 m68k powerpc sparc' + ;; + stable|testing|unstable|experimental) + arches='alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc' + ;; + esac + for component in $components; do + mkdir -p "$suitehere/$component" + for arch in $arches; do + mkdir -p "$suitehere/$component/binary-$arch" + wget $WGET_OPTS -O "$suitehere/$component/binary-$arch/Packages.gz" "$host/$root/$suite$suitesuffix/$component/binary-$arch/Packages.gz" + done + mkdir -p "$suite/$component/source" + wget $WGET_OPTS -O "$suite/$component/source/Sources.gz" "$host/$root/$suite$suitesuffix/$component/source/Sources.gz" + done + done +done + +exit 0 |