Mercurial > dnsbl
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 |
rev | line source |
---|---|
0 | 1 #!/bin/bash |
2 | |
3 ##################### | |
4 # stop the milter if it is already installed | |
5 if [ -f /etc/rc.d/init.d/dnsbl ]; then | |
6 /etc/rc.d/init.d/dnsbl stop | |
7 rm -f /etc/rc.d/init.d/dnsbl | |
8 fi | |
9 | |
10 | |
11 ##################### | |
12 # build the milter | |
14 | 13 # add compiler flags - suggested by Nigel Horne |
76 | 14 g++ -c $CXXFLAGS -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp |
8 | 15 if [ $? -ne 0 ]; then |
16 echo "compiler errors" | |
17 exit | |
18 fi | |
76 | 19 g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread |
8 | 20 if [ $? -ne 0 ]; then |
21 echo "linker errors" | |
0 | 22 exit |
23 fi | |
24 | |
25 | |
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 | 28 /usr/bin/getent passwd dnsbl || /usr/sbin/useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl |
0 | 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 | 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 | 38 CONF=$DST/dnsbl.conf |
77 | 39 if [ -f $CONF ]; then |
40 grep '^context' $CONF >/dev/null | |
76 | 41 if [ $? -eq 1 ]; then |
42 # config file exists, but it is for the older version | |
43 # preserve it and start over | |
44 suf=4.old | |
45 for i in dnsbl hosts-ignore html-tags tld; do | |
46 j=$DST/$i.conf | |
47 if [ -f $j ]; then | |
48 mv -f $j $j.$suf | |
49 fi | |
50 done | |
51 fi | |
52 fi | |
53 if [ ! -f $CONF ]; then | |
54 cp dnsbl.conf $DST | |
55 cp hosts-ignore.conf $DST | |
56 cp html-tags.conf $DST | |
57 cp tld.conf $DST | |
14 | 58 fi |
57 | 59 if [ ! -f $DST/hosts-ignore.conf ]; then |
60 cp hosts-ignore.conf $DST | |
61 fi | |
24 | 62 if [ ! -f $DST/html-tags.conf ]; then |
63 cp html-tags.conf $DST | |
64 fi | |
28 | 65 if [ ! -f $DST/tld.conf ]; then |
66 cp tld.conf $DST | |
67 fi | |
46 | 68 |
69 # make the directory for the socket | |
70 mkdir -p /var/run/dnsbl | |
71 chown dnsbl:dnsbl /var/run/dnsbl | |
72 chmod 700 /var/run/dnsbl | |
73 | |
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 | 76 cp dnsbl.rc /etc/rc.d/init.d/dnsbl |
77 chmod 755 /etc/rc.d/init.d/dnsbl | |
78 /sbin/chkconfig --add dnsbl | |
79 /sbin/chkconfig --level 2345 dnsbl on | |
80 /etc/rc.d/init.d/dnsbl start |