Creating an Slackware mirror
Today is a great day to Smaug, the router!
This week it just haven’t become my esteemed router, but it also is an Slackware mirror intended to my local (home) network and for eventual recorded CDs.
Using rsync it is preety straightforward and simple. Still, to automate the update process, I have created a script that, from now on, will be executed on a daily basis checking and updating my mirror. The script is available for download and for reading on this post. Although I am a native Portuguese speaker, I wrote the code and the comments in English to ease sharing (and suggestions, comments etc). For the documentation, download the script, uncompress it and run
grep \#\# slackware-mirror
on command line.
#!/bin/bash
# slackware-mirror
# Copyright (C) 2006 Renato "trovao" Cunha
SLACKWARE_RELEASES="slackware-11.0"
SOURCE="rsync://inferno.bioinformatics.vt.edu/slackware/"
OPTIONS="-avzP --delete --delete-after"
#EXCLUDE="source pasture kde kdei zipslack"
DEST="/slackware-mirror/"
case "$1" in
"check" )
echo "Checking..."
for e in $EXCLUDE
do
excluded="$excluded --exclude=$e"
done
for sr in $SLACKWARE_RELEASES
do
$RSYNC $OPTIONS --dry-run ${excluded} "${SOURCE}${sr}" "${DEST}"
done
;;
"download" )
echo "Downloading..."
for e in $EXCLUDE
do
excluded="$excluded --exclude=$e"
done
for sr in $SLACKWARE_RELEASES
do
$RSYNC $OPTIONS ${excluded} "${SOURCE}${sr}" "${DEST}"
done
;;
* )
echo "Usage: `basename $0` {check|download}"
echo -e "\tcheck: Check for updates"
echo -e "\tdownload: Download updates"
exit
;;
esac