# HG changeset patch # User darius@midget.dons.net.au # Date 1195952110 -37800 # Node ID afe5276c03f2868cfbc215c2f51cbc805d2f0baa # Parent 814f41175aed7c6e18477db6e65efc265a3f8575 Add option to make it quieter. diff -r 814f41175aed -r afe5276c03f2 update-pg --- a/update-pg Sun Nov 25 10:50:36 2007 +1030 +++ b/update-pg Sun Nov 25 11:25:10 2007 +1030 @@ -11,6 +11,37 @@ BASE=/var/db/peerguardian IPSATONCE=10000 +args=`getopt hq $*` +help=$? + +set -- $args +quiet=0 +for i; do + case "$i" in + -q) + quiet=1 + shift + ;; + + -h) + help=1 + shift + ;; + + --) + shift + break + ;; + esac +done + +if [ $help -ne 0 ]; then + echo "Usage: $0 [-hq]" + echo " -q: supress output on success" + exit 2 +fi + + if [ ! -w $BASE ]; then echo "Can't write to $BASE, giving up" >&2 exit 1 @@ -26,7 +57,9 @@ fi if [ -e $BASE/lastupdate -a ! $BASE/lastupdate -ot $BASE/p2p.php ]; then - echo "No update required" >&2 + if [ $quiet -eq 0 ]; then + echo "No update required" >&2 + fi exit 0 fi