summaryrefslogtreecommitdiff
path: root/mail/sqlgrey/files/patch-update__sqlgrey__config
blob: e2be8dc52df7069cbd55dd2aaa39ac07e49c3e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- update_sqlgrey_config.orig	2016-01-06 23:51:29 UTC
+++ update_sqlgrey_config
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/usr/local/bin/bash
 
-# We need md5sum, diff and wget
-MD5SUM=`which md5sum 2>/dev/null`
+# We need md5sum, diff and fetch
+MD5SUM=`which gmd5sum 2>/dev/null`
 if [ $? -ne 0 ]
 then
     echo "md5sum not found in PATH, can't continue"
@@ -13,10 +13,10 @@ then
     echo "diff not found in PATH, can't continue"
     exit -1
 fi
-WGET=`which wget 2>/dev/null`
+FETCH=`which fetch 2>/dev/null`
 if [ $? -ne 0 ]
 then
-    echo "wget not found in PATH, can't continue"
+    echo "fetch not found in PATH, can't continue"
     exit -1
 fi
 
@@ -24,7 +24,7 @@ fi
 LANG=C
 LC_ALL=C
 
-MYDIR=/etc/sqlgrey
+MYDIR=/usr/local/etc/sqlgrey
 CONF=$MYDIR/sqlgrey.conf
 
 # Get whitelists host and pidfile from conf
@@ -55,11 +55,11 @@ clean_exit() {
 trap clean_exit 2 3 15
 
 # Fetch MD5
-$WGET -q http://$whitelists_host/MD5SUMS
+$FETCH -q http://$whitelists_host/MD5SUMS
 
 # Check installed files
 cd $MYDIR
-TOUPDATE=`md5sum -c $MYTMP/MD5SUMS 2>/dev/null | grep FAILED | cut -d: -f1`
+TOUPDATE=`$MD5SUM -c $MYTMP/MD5SUMS 2>/dev/null | grep FAILED | cut -d: -f1`
 
 if [ -z "$TOUPDATE" ]
 then
@@ -77,7 +77,7 @@ for todownload in $TOUPDATE
 do
     echo "updating $MYDIR/$todownload:"
     rm $todownload 2>/dev/null
-    $WGET -N -q http://$whitelists_host/$todownload
+    $FETCH -q http://$whitelists_host/$todownload
     if [ -f $MYDIR/$todownload ]; then
 	$DIFF -u $MYDIR/$todownload $todownload
     else
@@ -85,7 +85,7 @@ do
     fi
 done
 
-md5sum -c MD5SUMS >/dev/null 2>/dev/null
+$MD5SUM -c MD5SUMS >/dev/null 2>/dev/null
 if [ $? -ne 0 ]
 then
     # Can only happen if remote site is borked or file got corrupt in transit