#!/bin/bash #Copyright (C) 2005 Daniel Harper #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. PGDIR=/usr/share/peerguardian echo -e "PeerGuardian Update Script\n" cd $PGDIR #check status of peerguardian echo -n "Checking status of PeerGuardian" if /etc/init.d/peerguardian status | grep -q "stopped"; then echo "....Stopped" status="1" else echo "....Started, Stopping" /etc/init.d/peerguardian stop fi echo -e "\nRemoving Old Files..." #check if files exist, before attempting to delete them if [ -f $PGDIR/p2p.p2b.p2p ] then rm -v p2p.p2b.p2p fi if [ -f $PGDIR/p2p.p2b.gz ] then rm -v p2p.p2b.gz fi if [ -f $PGDIR/p2p.p2b ] then rm -v p2p.p2b fi echo -e "\nGetting new blocklist..." wget -cnv blocklist.org/p2p.p2b.gz if [ ! -f $PGDIR/p2p.p2b.gz ] then echo -e "ERROR: BLOCKLIST NOT FOUND! QUIT\n" exit fi gunzip -q p2p.p2b.gz echo -e "\nUpdating PeerGuardian with new blocklist" peerguardnf -n p2p.p2b if [ "$status" == "1" ]; then echo "PeerGuardian is not running" else /etc/init.d/peerguardian start fi exit