I'm a avid Arch Linux fan. For some reason, I always want ultimate control over every CPU cycle in my laptop. Years ago I was a Gentoo user and would spend an entire weekend compiling my machine. Yea, it was a waste of time, but for some reason I got satisfaction out of it. The main elements that draw me to Arch are:
  • Distro does not make assumptions about what I want
  • Packages are up to date
  • Great community

My biggest beef with this rolling release distro is when I need a package, but I'm not ready to upgrade my entire machine. Often, the package dependencies require me to upgrade other critical packages. I can attempt to install an older version, but the packages disappear off the public repos. Sure, you can use ARM or downgrader, but its more trouble and doesn't always work.
Now, upgrading a package is not a huge deal, but things break and I don't have time to fix them every day.

My solution? A simple bash script that downloads the entire repo so that I always have a copy of the files. I put them on a private FTP server and configure pacman.conf to use it. That way, when I'm ready to upgrade, I just sync my private repo with the mirrors and I'm good to go.

Before you bash me for downloading / killing the public mirrors, keep these things in mind:

  • I only download what's changed since the last sync
  • I use lftp's mirror option to perform the sync
  • I limit my bandwidth using trickle

Another cool feature is that I use hardlinks to keep a permanent archive each time I sync. If there is trouble with my latest sync, I can just roll back to the previous one.

I know this isn't rocket science, but it solves a big problem in my world. Here is the code:

# This script expects two things:
# a symlink called archlinux pointing to an existing repo folder
# To get started, you can just create an empty folder and link it:
# mkdir archlinux-repo-tmp
# ln -s archlinux-repo-tmp archlinux
# ./syncrepo
DAY=`date +"%m-%d-%Y"`
LINK=`readlink archlinux`
echo $DAY
echo $LINK

cp -al $LINK archlinux-$DAY
cat > lftprc <<EOF
mirror --loop -ccn -P5 -X "*.iso"  YOUR-MIRROR-HERE archlinux-$DAY
trickle -sd 600 lftp -f lftprc
rm archlinux
ln -s archlinux-$DAY archlinux