1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#!/bin/sh
#
# partial mirror script for your machine by using debmirror
#
set -e
########################################################
MIRRORHOST=ftp.debian.org
DIST=unstable
NAME=partial
# if you don't want non-us packages, comment out NONUSHOST.
NONUSHOST=non-us.debian.org
NONUSDIST=unstable/non-US
NONUSNAME=partial-non-US
#### If you don't need sources, then uncommen this.
#NOSOURCE=--nosource
ARCH=i386
SIZE=CD74
DATADIR=/home/ftp/debian/
MIRRORDIR=/home/ftp/pub/debmirror
IGNORE_OPT="--ignore=Packages --ignore=Sources --ignore=Release"
########################################################
tmp=`tempfile`
trap "rm -f $tmp" 0
if test -z "$NONUSHOST"; then
NONUSDIST=""
NONUSNAME=""
fi
dpkg --get-selections | grep -v deinstall | awk -F' ' '{print $1;}' > $tmp &
install -d $DATADIR
debmirror -a $ARCH -h $MIRRORHOST \
-d $DIST --debug --exclude=. --nocleanup $DATADIR $NOSOURCE
if test -n "$NONUSHOST"; then
debmirror -a $ARCH -r debian-non-US -h $NONUSHOST \
-d $NONUSDIST --debug --exclude=. --nocleanup $DATADIR $NOSOURCE
fi
wait
find $MIRRORDIR/$NAME -name Packages.gz -o -name Sources.gz | while read f
do
zcat $f > `dirname $f`/`basename $f .gz`
done &
if test -n "$NONUSHOST"; then
find $MIRRORDIR/$NONUSNAME -name Packages.gz -o -name Sources.gz | while read f
do
zcat $f > `dirname $f`/`basename $f .gz`
done &
fi
debpartial --size=$SIZE -m -a $ARCH -D $NAME -l 1 \
-d "$DIST,$NONUSDIST" --include-from $tmp $DATADIR $MIRRORDIR $NOSOURCE
if test -n "$NONUSHOST"; then
IFS=','
for d in `echo $NONUSDIST`
do
install -d $MIRRORDIR/$NONUSNAME/dists/$d
cp -a $MIRRORDIR/$NAME/dists/$d/* $MIRRORDIR/$NONUSNAME/dists/$d
done
fi
IFS=" "
debmirror -a $ARCH -h $MIRRORHOST -d $DIST --debug \
$IGNORE_OPT $MIRRORDIR/$NAME --skippackages $NOSOURCE &
if test -n "$NONUSHOST"; then
debmirror -r debian-non-US -a $ARCH -h $NONUSHOST -d $NONUSDIST --debug \
$IGNORE_OPT $MIRRORDIR/$NONUSNAME --skippackages $NOSOURCE
fi
wait
|