#!/bin/bash
#
# erstellt am 06.05.07
# (c) 2007 Klaus Staerk <klaus.staerk@gmx.net>
#
# This program is Free Software under the GNU General Public License (>=v2).
# Read the file COPYING that comes with this packages for details.

#---------------------------------------------------------------------------
# Mirror-Verzeichnisse
#---------------------------------------------------------------------------
DEB_MIRRORDIR=/var/cache/debian-40-security-mirror
DEB_COPYDIR=/var/cache/debian-40-security-packages


#---------------------------------------------------------------------------
# Verzeichnisse vorhanden?
#---------------------------------------------------------------------------
if [ ! -e $DEB_MIRRORDIR ]; then 
  mkdir -p $DEB_MIRRORDIR
fi  
if [ ! -e $DEB_COPYDIR ]; then 
  mkdir -p $DEB_COPYDIR
fi  


#---------------------------------------------------------------------------
# Debian-Architektur 
#---------------------------------------------------------------------------
DEB_ARCH=--arch=i386


#---------------------------------------------------------------------------
# Debian-Sektionen 
#---------------------------------------------------------------------------
DEB_SECTIONS=--section=main,contrib,non-free


#---------------------------------------------------------------------------
# Debian-Host 
#---------------------------------------------------------------------------
DEB_HOST=--host=security.debian.org


#---------------------------------------------------------------------------
# Debian-Release 
#---------------------------------------------------------------------------
DEB_DIST=--dist=etch/updates


#---------------------------------------------------------------------------
# Proxy im LAN?
#---------------------------------------------------------------------------
# e.g.  --proxy=http://proxy.mydomain.loc:3128
#
DEB_PROXY=


#---------------------------------------------------------------------------
# Download-Methode 
#---------------------------------------------------------------------------
# e.g. http, ftp, hftp, rsync
DEB_METHOD=--method=http


#---------------------------------------------------------------------------
# Debian-Rootverzeichnis fuer Sicherheits-Updates 
#---------------------------------------------------------------------------
DEB_ROOT=--root=/debian-security


#---------------------------------------------------------------------------
# Download im Passiv-Modus? 
#---------------------------------------------------------------------------
DEB_PASSIVE=--passive


#---------------------------------------------------------------------------
# Debian Mirror beginnt ... 
#---------------------------------------------------------------------------
echo " "
echo " "
echo "================================================================="
echo "|                                                               |"
echo "|               DEBIAN GNU/Linux Security Mirror                |"
echo "|                                                               |"
echo "================================================================="
echo " "
echo " "
echo ">> Debian Security Mirror wird aktualisiert ..."
echo " "
/usr/bin/debmirror -v --progress --nosource --ignore-release-gpg $DEB_PARAMS $DEB_MIRRORDIR $DEB_PASSIVE $DEB_ARCH $DEB_SECTIONS $DEB_HOST $DEB_DIST $DEB_PROXY $DEB_METHOD $DEB_ROOT
echo " "
echo ">> Aktualisierung des Debian Security Mirrors BEENDET ..."
echo " "


#---------------------------------------------------------------------------
# Debian-Pakete ins Zielverzeichnis kopieren 
#---------------------------------------------------------------------------
echo " "
echo ">> Debian Security Pakete werden kopiert ..."
echo " "
find $DEB_MIRRORDIR -name "*.deb" -exec cp -v -u {} $DEB_COPYDIR \;
echo " "
echo ">> Kopieren der Debian Security Pakete BEENDET ..."
echo " "
