annotate install.bash @ 89:946fc1bcfb2c stable-5-3

don't load null config pointer, keep the old one
author carl
date Sun, 07 Aug 2005 11:26:37 -0700
parents 8487650c98ee
children 505e77188317
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a9758165cd Initial revision
carl
parents:
diff changeset
1 #!/bin/bash
96a9758165cd Initial revision
carl
parents:
diff changeset
2
96a9758165cd Initial revision
carl
parents:
diff changeset
3 #####################
96a9758165cd Initial revision
carl
parents:
diff changeset
4 # stop the milter if it is already installed
96a9758165cd Initial revision
carl
parents:
diff changeset
5 if [ -f /etc/rc.d/init.d/dnsbl ]; then
96a9758165cd Initial revision
carl
parents:
diff changeset
6 /etc/rc.d/init.d/dnsbl stop
96a9758165cd Initial revision
carl
parents:
diff changeset
7 rm -f /etc/rc.d/init.d/dnsbl
96a9758165cd Initial revision
carl
parents:
diff changeset
8 fi
96a9758165cd Initial revision
carl
parents:
diff changeset
9
96a9758165cd Initial revision
carl
parents:
diff changeset
10
96a9758165cd Initial revision
carl
parents:
diff changeset
11 #####################
96a9758165cd Initial revision
carl
parents:
diff changeset
12 # build the milter
14
443aa0e8c6fa changes suggested by Nigel Horne
carl
parents: 8
diff changeset
13 # add compiler flags - suggested by Nigel Horne
76
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
14 g++ -c $CXXFLAGS -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp
8
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
15 if [ $? -ne 0 ]; then
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
16 echo "compiler errors"
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
17 exit
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
18 fi
76
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
19 g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread
8
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
20 if [ $? -ne 0 ]; then
dbe18921f741 integration work on url scanner
carl
parents: 5
diff changeset
21 echo "linker errors"
0
96a9758165cd Initial revision
carl
parents:
diff changeset
22 exit
96a9758165cd Initial revision
carl
parents:
diff changeset
23 fi
96a9758165cd Initial revision
carl
parents:
diff changeset
24
96a9758165cd Initial revision
carl
parents:
diff changeset
25
96a9758165cd Initial revision
carl
parents:
diff changeset
26 #####################
41
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
27 # ensure the user is created
42
afcf403709ef updates for 3.2, try to drop root privileges
carl
parents: 41
diff changeset
28 /usr/bin/getent passwd dnsbl || /usr/sbin/useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl
0
96a9758165cd Initial revision
carl
parents:
diff changeset
29 # install the milter
41
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
30 DST=/etc/dnsbl
0
96a9758165cd Initial revision
carl
parents:
diff changeset
31 mkdir -p $DST
41
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
32 if [ -f /var/dnsbl/dnsbl.conf ]; then
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
33 # move the conf files to the new location
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
34 mv /var/dnsbl/*conf $DST
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
35 rm /var/dnsbl/dnsbl # remove the old binary
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
36 rmdir /var/dnsbl
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
37 fi
76
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
38 CONF=$DST/dnsbl.conf
77
8487650c98ee start coding on new config syntax
carl
parents: 76
diff changeset
39 if [ -f $CONF ]; then
8487650c98ee start coding on new config syntax
carl
parents: 76
diff changeset
40 grep '^context' $CONF >/dev/null
76
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
41 if [ $? -eq 1 ]; then
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
42 # config file exists, but it is for the older version
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
43 # preserve it and start over
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
44 suf=4.old
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
45 for i in dnsbl hosts-ignore html-tags tld; do
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
46 j=$DST/$i.conf
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
47 if [ -f $j ]; then
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
48 mv -f $j $j.$suf
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
49 fi
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
50 done
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
51 fi
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
52 fi
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
53 if [ ! -f $CONF ]; then
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
54 cp dnsbl.conf $DST
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
55 cp hosts-ignore.conf $DST
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
56 cp html-tags.conf $DST
81f1e400e8ab start coding on new config syntax
carl
parents: 57
diff changeset
57 cp tld.conf $DST
14
443aa0e8c6fa changes suggested by Nigel Horne
carl
parents: 8
diff changeset
58 fi
57
419e00901570 changes to handle 5iantlavalamp.com
carl
parents: 46
diff changeset
59 if [ ! -f $DST/hosts-ignore.conf ]; then
419e00901570 changes to handle 5iantlavalamp.com
carl
parents: 46
diff changeset
60 cp hosts-ignore.conf $DST
419e00901570 changes to handle 5iantlavalamp.com
carl
parents: 46
diff changeset
61 fi
24
2e23b7184d2b start coding for bad html tag detection
carl
parents: 23
diff changeset
62 if [ ! -f $DST/html-tags.conf ]; then
2e23b7184d2b start coding for bad html tag detection
carl
parents: 23
diff changeset
63 cp html-tags.conf $DST
2e23b7184d2b start coding for bad html tag detection
carl
parents: 23
diff changeset
64 fi
28
33e1e3910506 add configurable list of tlds
carl
parents: 24
diff changeset
65 if [ ! -f $DST/tld.conf ]; then
33e1e3910506 add configurable list of tlds
carl
parents: 24
diff changeset
66 cp tld.conf $DST
33e1e3910506 add configurable list of tlds
carl
parents: 24
diff changeset
67 fi
46
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
68
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
69 # make the directory for the socket
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
70 mkdir -p /var/run/dnsbl
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
71 chown dnsbl:dnsbl /var/run/dnsbl
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
72 chmod 700 /var/run/dnsbl
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
73
66c66a6ee65f changes for 3.2
carl
parents: 42
diff changeset
74 # install the binaries
41
d95af8129dfa updates for 3.2, changing file layout, add queueid to messages
carl
parents: 37
diff changeset
75 mv -f dnsbl /usr/sbin/dnsbl
0
96a9758165cd Initial revision
carl
parents:
diff changeset
76 cp dnsbl.rc /etc/rc.d/init.d/dnsbl
96a9758165cd Initial revision
carl
parents:
diff changeset
77 chmod 755 /etc/rc.d/init.d/dnsbl
96a9758165cd Initial revision
carl
parents:
diff changeset
78 /sbin/chkconfig --add dnsbl
96a9758165cd Initial revision
carl
parents:
diff changeset
79 /sbin/chkconfig --level 2345 dnsbl on
96a9758165cd Initial revision
carl
parents:
diff changeset
80 /etc/rc.d/init.d/dnsbl start