Report abuse

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# $Id$

PortSystem          1.0

name                ASSP
#version             1.5.1.8
version             1.6.5.3
categories          mail
maintainers         hostwizard.com:scott

description         Anti-Spam SMTP Proxy (ASSP) Server

long_description    The Anti-Spam SMTP Proxy (ASSP) Server is an open \
                    source, platform-independent SMTP Proxy server which \
                    implements whitelists and Bayesian filtering to rid \
                    the planet of the blight of unsolicited email (UCE). \
                    UCE must be stopped at the SMTP server.  Anti-spam \
                    tools must be adaptive to new spam and customized \
                    for each sites mail patterns. This free, \
                    easy-to-use tool works with any mail transport and \
                    achieves these goals requiring no operator \
                    intervention after the initial setup phase.

homepage            http://assp.sourceforge.net/

platforms           darwin
master_sites        sourceforge
livecheck.regex     "ASSP Installation ASSP (\\d+(?:\\.\\d+)*) released"
use_zip             yes

checksums           md5     a0474866056978f5efa639c5e82f7df5 \
                    sha1    2475ad9fdf9649aa532495ac0179adb2996d9845 \
                    rmd160  4e41579909b02be7aa0d7464c8325fc3c1b2c872

depends_run         bin:perl:perl5.8

distname            ASSP_${version}-Install
worksrcdir          ${distname}/ASSP
set assp_base       ${prefix}/var/ASSP

# This distribution is just perl files
use_configure       no

#port:p5-compress-zlib \
depends_lib         port:p5-io-compress \
                    port:p5-digest-md5 \
                    port:p5-digest-sha1 \
                    port:p5-email-mime-modifier \
                    port:p5-email-send \
                    port:p5-email-valid \
                    port:p5-file-readbackwards \
                    port:p5-io-socket-ssl \
                    port:p5-libwww-perl \
                    port:p5-mail-spf \
                    port:p5-mail-srs \
                    port:p5-net \
                    port:p5-net-cidr-lite \
                    port:p5-net-dns \
                    port:p5-net-ip-match-regexp \
                    port:p5-net-senderbase \
                    port:p5-net-syslog \
                    port:p5-perl-ldap \
                    port:p5-sys-syslog \
                    port:p5-tie-dbi \
                    port:p5-time-hires \
                    port:p5-io-socket-ssl \
                    port:p5-email-send \
                    port:p5-text-iconv \
                    port:p5-io-socket-inet6

ui_info " MY DEBUG: worksrcdir: ${worksrcdir}"
ui_info " MY DEBUG: worksrcpath: ${worksrcpath}"
ui_info " MY DEBUG: destroot: ${destroot}"
ui_info " MY DEBUG: prefix: ${prefix}"

# Convert DOS line endings, original port had this feature, maintaining it
# for reasons I am not entirely sure, but updated it to be easier to maintain
pre-patch {
     ui_info " MY DEBUG: Starting pre-patch"
     # ASSP comes with out of date docs in ASSP/docs
     # A bug in MacPorts http://trac.macports.org/ticket/17098
     # fails on anything if there are spaces in filenames
     # Kill the docs directory, we do not neet it
     file delete -force "${worksrcpath}/docs"

     # This is not Windows, get rid of it
     file delete -force "${worksrcpath}/addservice.pl"

     # fs-traverse /*\rules/*\
     # Run the worksrcpath, replace out all DOS line endings in
     # files matching a file extension
     fs-traverse file ${worksrcpath} {
          set file_extensions {*.pl *.sh *.txt *.dat}
          foreach file_extension $file_extensions {
               if [string match -nocase $file_extension $file] {
                    ui_info " MY DEBUG: fs-traverse found MATCH: $file, -> reinplace it"
                    reinplace "s%\r%%" $file
                    reinplace "s%^#!.*perl%#![binaryInPath perl]%" ${file}
                    reinplace "s%/usr/local/assp%${assp_base}%" ${file}
               }
          }
     }

     # Patch the 'assp.cfg.defaults' file to use the correct user and group
     reinplace "s|runAsUser:=|runAsUser:=_assp|" ${worksrcpath}/assp.cfg.defaults
     reinplace "s|runAsGroup:=|runAsGroup:=_assp|" ${worksrcpath}/assp.cfg.defaults

     ui_info " MY DEBUG: Ending pre-patch"
}

configure {}

build {}

pre-destroot {
     addgroup _assp
     set gid [existsgroup _assp]
     adduser _assp gid=${gid} realname=ASSP Proxy home=${prefix}/var/ASSP
}

destroot {
     # Creae the directory where all ASSP files and subdirectories are to live
     ui_info " MY DEBUG: Making ${destroot}${assp_base}"
     xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}

     # Intall the assp.cfg.defaults file
     xinstall -o _assp -g _assp -m 0755 -W ${worksrcpath} \
          assp.cfg.defaults \
          ${destroot}${assp_base}

     # Intall the root level perl files
     xinstall -o _assp -g _assp -m 0755 -W ${worksrcpath} \
          assp.pl move2num.pl rebuildspamdb.pl stat.pl \
          ${destroot}${assp_base}

     # Create 'files' directory in ASSP base, install everything in it
     xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}/files
     foreach file [glob -directory ${worksrcpath}/files *] {
          xinstall -o _assp -g _assp -m 0644 $file ${destroot}${assp_base}/files
     }

     # Create 'reports' directory in ASSP base, install everything in it
     xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}/reports
     foreach file [glob -directory ${worksrcpath}/reports *] {
          xinstall -m 0644 $file ${destroot}${assp_base}/reports
     }

     # Create 'images' directory in ASSP base, install everything in it
     xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}/images
     foreach file [glob -directory ${worksrcpath}/images *] {
          xinstall -m 0644 $file ${destroot}${assp_base}/images
     }

     # Create empty directories in ASSP base
     xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}/logs
     #xinstall -m 0644 ${worksrcpath}/mod_inst.pl ${destroot}${assp_base}/logs/mod_inst.pl

     set empty_dirs {docs certs errors logs notes notspam okmail pb quarantine spam}
     foreach empty_dir $empty_dirs {
          ui_info " MY DEBUG: Making empty dir at ${destroot}${assp_base}/$empty_dir"
          xinstall -d -o _assp -g _assp -m 0755 ${destroot}${assp_base}/$empty_dir
          destroot.keepdirs-append ${destroot}${assp_base}/${empty_dir}
     }

}


pre-install {
     addgroup _assp
     set gid [existsgroup _assp]
     adduser _assp gid=${gid} realname=ASSP Proxy home=${prefix}/var/ASSP
}


post-activate {
     # The user and group in 'assp.cfg.defaults' was changed, id this is a new
     # install, copy it to active
     if {![file exists ${assp_base}/assp.cfg]} {
          file copy ${assp_base}/assp.cfg.defaults \
               ${assp_base}/assp.cfg
     ui_msg "
     ========================================================================
     ASSP has been installed correctly, a startup item has been installed...

     You can test it now with
     cd ${prefix}/var/ASSP
     ${prefix}/bin/perl assp.pl

     Point your browser to http://127.0.0.1:55555/ -- put anything you like
     in the username and use the password nospam4me to connect. If everything
     is working correctly you will see a beautifully formatted configuration
     screen with all of ASSP's fabulous features spelled out for you in
     painful detail. Simply click the options you want, type a few
     customizations if you like and you're on your way.

     At a minimum you'll want to change values for 'Web Admin Password,'
     'Accept All Mail,' 'Local Domains,' 'Spam Error,' and 'Spam Addresses.'
     The password for your server is posted in bold on the internet for
     EVERYONE to see, so if you don't change it, you deserve what you get.
     Also remember to press Enter or click the button at the bottom to
     register your changes - simply clearing a checkbox doesn't send the
     change to ASSP.

     See ${homepage} for more information.
     ========================================================================
"
     }
}