-
-
Save Torstein-Eide/74a78696ce2ca14571c2ab6c0480057d to your computer and use it in GitHub Desktop.
debmirror script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DEBMLOG=/pool/debmirror/debmirror.log | |
MIRRORDIR=/pool/debmirror | |
BANDWIDTH=500 | |
if test -s $DEBMLOG | |
then | |
test -f $DEBMLOG.3.gz && mv $DEBMLOG.3.gz $DEBMLOG.4.gz | |
test -f $DEBMLOG.2.gz && mv $DEBMLOG.2.gz $DEBMLOG.3.gz | |
test -f $DEBMLOG.1.gz && mv $DEBMLOG.1.gz $DEBMLOG.2.gz | |
test -f $DEBMLOG.0 && mv $DEBMLOG.0 $DEBMLOG.1 && gzip $DEBMLOG.1 | |
mv $DEBMLOG $DEBMLOG.0 | |
cp /dev/null $DEBMLOG | |
chmod 640 $DEBMLOG | |
fi | |
# Record the current date/time | |
date 2>&1 | tee -a $DEBMLOG | |
# Debian General | |
echo "\n*** Debian General ***\n" 2>&1 | tee -a $DEBMLOG | |
debmirror --i18n --method=rsync --progress --rsync-options "-aIL --partial --bwlimit=$BANDWIDTH" \ | |
--host=mirror.internode.on.net \ | |
$MIRRORDIR/mirror.internode.on.net/pub/debian/ \ | |
--arch=i386,amd64,powerpc,armel \ | |
--dist=squeeze,wheezy,sid \ | |
2>&1 | tee -a $DEBMLOG | |
# Debian Security | |
echo "\n*** Debian Security ***\n" 2>&1 | tee -a $DEBMLOG | |
debmirror -i18n --method=rsync --progress --rsync-options "-aIL --partial --bwlimit=$BANDWIDTH" \ | |
--host=mirror.internode.on.net \ | |
$MIRRORDIR/mirror.internode.on.net/pub/debian-security/ \ | |
--arch=i386,amd64,powerpc,armel \ | |
--dist=squeeze/updates,wheezy/updates \ | |
--root=debian-security \ | |
--ignore-small-errors \ | |
2>&1 | tee -a $DEBMLOG | |
# Ubuntu General | |
echo "\n*** Ubuntu General ***\n" 2>&1 | tee -a $DEBMLOG | |
debmirror --i18n --method=rsync --progress --rsync-options "-aIL --partial --bwlimit=$BANDWIDTH" \ | |
--host=mirror.internode.on.net \ | |
$MIRRORDIR/mirror.internode.on.net/pub/ubuntu/ubuntu \ | |
--arch=i386,amd64 \ | |
--dist=precise,precise-security,precise-updates,precise-backports \ | |
--root=:ubuntu/ubuntu \ | |
--section=main,main/debian-installer,restricted,restricted/debian-installer,\--arch=amd64,armel,i386,powerpc \ | |
--dist=stable,testing,unstable,experimental \ | |
--root=deb \ | |
--section=main,non-free \ | |
--ignore-small-errors \ | |
2>&1 | tee -a $DEBMLOG | |
## Our friends at Google. Including a leading / in the root causes failure. | |
#echo "\n*** Google ***\n" 2>&1 | tee -a $DEBMLOG | |
#debmirror --debug --nosource --method=http --md5sums --progress --ignore-release-gpg \ | |
#--host=dl.google.com \ | |
#--root=linux \ | |
#--dist=stable \ | |
#--section=main,non-free \ | |
#--arch=i386 \ | |
#$MIRRORDIR/dl.google.com/google \ | |
#2>&1 | tee -a $DEBMLOG | |
echo "\n*** Fixing ownership ***\n" 2>&1 | tee -a $DEBMLOG | |
find $MIRRORDIR -type d -o -type f -exec chown kleinig:public '{}' \; \ | |
2>&1 | tee -a $DEBMLOG | |
echo "\n*** Fixing permissions ***\n" 2>&1 | tee -a $DEBMLOG | |
find $MIRRORDIR -type d -o -type f -exec chmod u+rw,g+r,o+r-w {} \; \ | |
2>&1 | tee -a $DEBMLOG | |
echo "\n*** Mirror size ***\n" 2>&1 | tee -a $DEBMLOG | |
du -hs $MIRRORDIR 2>&1 | tee -a $DEBMLOG | |
# Record the current date/time | |
date 2>&1 | tee -a $DEBMLOG | |
universe,universe/debian-installer,multiverse,multiverse/debian-installer \ | |
2>&1 | tee -a $DEBMLOG | |
# Debian Multimedia | |
echo "\n*** Debian Multimedia ***\n" 2>&1 | tee -a $DEBMLOG | |
debmirror --i18n --method=rsync --progress --rsync-options "-aIL --partial --bwlimit=$BANDWIDTH" \ | |
--host=www.deb-multimedia.org \ | |
$MIRRORDIR/www.debian-multimedia.org/pub/debian-mm/ \ | |
--arch=amd64,armel,i386,powerpc \ | |
--dist=stable,testing,unstable,experimental \ | |
--root=deb \ | |
--section=main,non-free \ | |
--ignore-small-errors \ | |
2>&1 | tee -a $DEBMLOG | |
## Our friends at Google. Including a leading / in the root causes failure. | |
#echo "\n*** Google ***\n" 2>&1 | tee -a $DEBMLOG | |
#debmirror --debug --nosource --method=http --md5sums --progress --ignore-release-gpg \ | |
#--host=dl.google.com \ | |
#--root=linux \ | |
#--dist=stable \ | |
#--section=main,non-free \ | |
#--arch=i386 \ | |
#$MIRRORDIR/dl.google.com/google \ | |
#2>&1 | tee -a $DEBMLOG | |
echo "\n*** Fixing ownership ***\n" 2>&1 | tee -a $DEBMLOG | |
find $MIRRORDIR -type d -o -type f -exec chown kleinig:public '{}' \; \ | |
2>&1 | tee -a $DEBMLOG | |
echo "\n*** Fixing permissions ***\n" 2>&1 | tee -a $DEBMLOG | |
find $MIRRORDIR -type d -o -type f -exec chmod u+rw,g+r,o+r-w {} \; \ | |
2>&1 | tee -a $DEBMLOG | |
echo "\n*** Mirror size ***\n" 2>&1 | tee -a $DEBMLOG | |
du -hs $MIRRORDIR 2>&1 | tee -a $DEBMLOG | |
# Record the current date/time | |
date 2>&1 | tee -a $DEBMLOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment