Skip to content

Instantly share code, notes, and snippets.

@arno
Created November 23, 2009 19:00
Show Gist options
  • Save arno/241276 to your computer and use it in GitHub Desktop.
Save arno/241276 to your computer and use it in GitHub Desktop.
#!/bin/sh
BLOCKLIST_DIR=/usr/local/etc/transmission/home/blocklists
BLOCKLIST_NAME=level1
BLOCKLIST_URL=http://update.transmissionbt.com/$BLOCKLIST_NAME.gz
tempdir=$(mktemp -d -q /tmp/transmission.XXXXXX)
if [ $? -ne 0 ]; then
echo "problem creating temp file, exiting..."
exit 1
fi
die() {
echo >&2 "$@"
[ -d $tempdir ] && rm -rf $tempdir >/dev/null 2>&1
exit 1
}
#/usr/local/bin/curl -sS $BLOCKLIST_URL -o $tempdir/level1.gz
/usr/bin/fetch -q -o $tempdir $BLOCKLIST_URL || \
die "problem downloading $BLOCKLIST_NAME.gz, exiting..."
gunzip -cd $tempdir/level1.gz > $BLOCKLIST_DIR/$BLOCKLIST_NAME || \
die "problem uncompressing $BLOCKLIST_NAME.gz, exiting..."
rm -rf $tempdir
echo "successfully installed new blocklist"
# vim: et sw=4 ts=4:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment