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

Re: looking for debian mirror script that can do dists/proposed-updates



On Mon, Feb 05, 2001 at 02:23:03PM +0100, Thomas Lange wrote:
> for my fully automatic installation (FAI) for Debian I need a local
> mirror. But since we are using package pools I have great problems to
> keep my local mirror in sync. Is there one script, that supports
> mirroring of proposed-updates ?

this is the script i use to update my own local mirror through a 
normal 64K isdn line with rsync. 
it mirrors both pool and no pool sections of the i386 and source
architecture. 
it mirrors alls distros (stable, testing, unstable) and has no features
to distinguish between them if it mirrors from package pools.
( this fits my needs but perhaps not yours. )

have a look at it and tell me whether u will use it or what lacks 
for you.

MfG

Daniel
#!/bin/bash
###############################################################################

###############################################################################
function excludes-nopool {

EXF=`mktemp /tmp/rsync.debmir.XXXXXX`
echo '
# this is the on-the-fly created excludefile from rsync.debmir

#- /sid/
- /slink/
- /slink*/

+ /*roposed-updates/
+ /*roposed-updates/*all.deb
+ /*roposed-updates/*i386.deb
+ /*roposed-updates/Packages
- /*roposed-updates/**

+ Contents-i386.gz
- Contents-*.gz
#- Packages.gz

- **/disks-*/
- **/upgrade-*/
+ **/binary-all/
+ **/binary-all/**
+ **/binary-i386/
+ **/binary-i386/**
- **/binary-*
- **/binary-*/
- **/source/

' >$EXF
}

###############################################################################
function excludes-pool {

EXF=`mktemp /tmp/rsync.debmir.XXXXXX`
echo '
# this is the on-the-fly created excludefile from rsync.debmir

# pool excludes

# include all directories
+ */

# include i386, all
+ *_i386.deb
+ *_all.deb

# include source
+ *.dsc
+ *.diff.gz
+ *.orig.tar.gz

# exclude rest
- *

' >$EXF
}

###############################################################################
function setflags {
    FLAGS="$USERPARAM --recursive --links --times --verbose --compress --partial --delete --delete-excluded --delete-after --timeout=100"
    if [ "$LANGEX" ] ; then
      FLAGS="$FLAGS --exclude-from=$LANGEX"
    fi
    if [ "$EXF" ] ; then
      FLAGS="$FLAGS --exclude-from=$EXF"
    fi
}

###############################################################################
function domirror {
  umask 022

  mkdir -p $DST

  echo "########### rsync $FLAGS $SRC $DST"

  rsync $FLAGS $SRC $DST

  echo ">>>>>>>>>>> rsync returned: <$?>"

  rm $EXF
}

###############################################################################
function mirror-us-nopool {
#    SRC=debian.ethz.ch::debian/dists/
#    SRC=ftp.de.debian.org::debian/dists/
    SRC=ftp.fr.debian.org::debian/dists/
    DST=/usr/local/ftp/mirror/debian/dists
    
    LANGEX=/usr/local/debmir/language-excludes
    excludes-nopool
    setflags

    domirror
}
  
function mirror-nonus-nopool {
#    SRC=debian.ethz.ch::debian-non-us/dists/
#    SRC=ftp.de.debian.org::debian-non-US/dists/
    SRC=ftp.fr.debian.org::debian-non-US/dists/
    DST=/usr/local/ftp/mirror/debian-non-US/dists
    
    LANGEX=/usr/local/debmir/language-excludes
    excludes-nopool
    setflags

    domirror
}

function mirror-security {
    SRC=non-us.debian.org::debian-security/dists/
    DST=/usr/local/ftp/mirror/debian-security/dists
    
    unset LANGEX
    excludes-nopool
    setflags

    domirror
}

function mirror-us-pool {
#    SRC=debian.ethz.ch::debian/pool/
#    SRC=ftp.de.debian.org::debian/pool/
    SRC=ftp.fr.debian.org::debian/pool/
    DST=/usr/local/ftp/mirror/debian/pool

    unset LANGEX
    excludes-pool
    setflags

    domirror
}

function mirror-nonus-pool {
#    SRC=debian.ethz.ch::debian-non-us/pool/
#    SRC=ftp.de.debian.org::debian-non-US/pool/
    SRC=ftp.fr.debian.org::debian-non-US/pool/
    DST=/usr/local/ftp/mirror/debian-non-US/pool

    unset LANGEX
    excludes-pool
    setflags

    domirror
}

###############################################################################
## MAIN ##

USERPARAM=$2

case "$1" in
  all)
    echo -ne "\n\nStarting on `date`\n"
    mirror-security
    date
    mirror-us-nopool
    date
    mirror-nonus-nopool
    date
    mirror-us-pool
    date
    mirror-nonus-pool
    echo -ne "Finished on `date`\n\n"
  ;;
  us-nopool)
    mirror-us-nopool
  ;;
  nonus-nopool)
    mirror-nonus-nopool
  ;;
  security)
    mirror-security
  ;;
  us-pool)
    mirror-us-pool
  ;;
  nonus-pool)
    mirror-nonus-pool
  ;;
  *)
    echo "Call me with: debmir [ security | us-nopool | nonus-nopool | us-pool | nonus-nopool | all ] 'rsyncparameters'" >&2
    exit 1
  ;;
esac

###############################################################################

Reply to: