Tuesday, December 14, 2010

tarpac

Pacman cache archiving. Right now it just gzips everything in the /var/cache/pacman/pkg directory, then cleans the pacman cache. The only problem is that the --clean flag keeps the most current package tarballs, which have also been archived, so there's a going to be redundancy in the archives. I need to write in a way to ignore the most recent of the tarballs, just haven't figured that out yet.

#!/bin/bash
# create a dated archive of the pacman cache

chkroot && [[ $? = 0 ]] || exit 1

cd /var/cache/
tar pczf /home/jason/pacmancache-`date +%F`.tar.gz pacman/pkg
[[ $? = 0 ]] || echo "archive failed"; exit 1

echo "clearing old cache..."
pacman -S --clean
exit 0

No comments:

Post a Comment