Ticket #34229: Portfile

File Portfile, 3.5 KB (added by fclaire@…, 13 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem              1.0
5PortGroup               github 1.0
6PortGroup               python27 1.0
7
8github.setup            fail2ban fail2ban 0.8.6
9categories              security python
10license                 GPL-2+
11maintainers             free.fr:fclaire openmaintainer
12platforms               darwin
13homepage                http://www.fail2ban.org
14description             Fail2ban protects computer against brute-force attacks
15
16long_description        Fail2ban scans log files (e.g. /var/log/apache/error_log) and \
17                        bans IPs that show the malicious signs -- too many password failures, \
18                        seeking for exploits, etc. Generally Fail2Ban then used to update \
19                        firewall rules to reject the IP addresses for a specified amount \
20                        of time, although any arbitrary other action (e.g. sending an email, \
21                        or ejecting CD-ROM tray) could also be configured. Out of the box \
22                        Fail2Ban comes with filters for various services (apache, curier, ssh, etc).
23
24checksums               sha256  24d02422c55f1b7d92bea30a7dde6f72f280eadf09d478fcca8b1dd40fb4e914 \
25                        rmd160  70678ca46849a462367603fb3d0e2c6c2f3b75cf
26
27set f2bconfdir          ${prefix}/etc/${name}
28set f2bbindir           ${prefix}/bin
29
30python.link_binaries_suffix
31
32patchfiles              patch-setup.py.diff \
33                        patch-setup.cfg.diff \
34                        patch-fail2ban-client.diff \
35                        patch-fail2ban-regex.diff \
36                        patch-fail2ban-server.diff \
37                        patch-config-fail2ban.conf.diff \
38                        patch-client-csocket.py.diff \
39                        patch-server-server.py.diff
40
41post-patch   {
42        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.py
43        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.cfg
44        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-client
45        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-regex
46        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-server
47        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/client/csocket.py
48        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/config/fail2ban.conf
49        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/server/server.py
50}
51
52startupitem.create      yes
53startupitem.start       "${f2bbindir}/${name}-client start"
54startupitem.stop        "${f2bbindir}/${name}-client stop"
55
56destroot.keepdirs       ${destroot}${prefix}/var/run/fail2ban
57
58post-destroot {
59        # Adding a suffix to config files
60        set cfgfiles [concat [glob ${destroot}${f2bconfdir}/*.conf] [glob ${destroot}${f2bconfdir}/action.d/*.conf] [glob ${destroot}${f2bconfdir}/filter.d/*.conf]]
61        foreach cfgfile ${cfgfiles} {
62                move ${cfgfile} ${cfgfile}.${version}
63        }
64}
65
66post-activate {
67        # If not already present we put default config files
68        set cfgfiles [concat [glob ${f2bconfdir}/*.conf.${version}] [glob ${f2bconfdir}/action.d/*.conf.${version}] [glob ${f2bconfdir}/filter.d/*.conf.${version}]]
69        foreach cfgfile ${cfgfiles} {
70                regsub "\.${version}" ${cfgfile} {} origcfgfile
71                if {![file exists ${origcfgfile}]} {
72                        file copy ${cfgfile} ${origcfgfile}
73                }
74        }
75}