Mercurial > dnsbl
annotate install.bash @ 103:5569df6d896e
updated packaging
author | carl |
---|---|
date | Thu, 08 Dec 2005 13:56:04 -0800 |
parents | 505e77188317 |
children |
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 | |
92 | 65 rm -f $DST/tld.conf # new tld list |
28 | 66 if [ ! -f $DST/tld.conf ]; then |
67 cp tld.conf $DST | |
68 fi | |
46 | 69 |
70 # make the directory for the socket | |
71 mkdir -p /var/run/dnsbl | |
72 chown dnsbl:dnsbl /var/run/dnsbl | |
73 chmod 700 /var/run/dnsbl | |
74 | |
75 # install the binaries | |
41
d95af8129dfa
updates for 3.2, changing file layout, add queueid to messages
carl
parents:
37
diff
changeset
|
76 mv -f dnsbl /usr/sbin/dnsbl |
0 | 77 cp dnsbl.rc /etc/rc.d/init.d/dnsbl |
78 chmod 755 /etc/rc.d/init.d/dnsbl | |
79 /sbin/chkconfig --add dnsbl | |
80 /sbin/chkconfig --level 2345 dnsbl on | |
81 /etc/rc.d/init.d/dnsbl start |