source: trunk/dports/www/privoxy/Portfile @ 75015

Last change on this file since 75015 was 75015, checked in by kimuraw@…, 8 years ago

www/privoxy: fix #23970, config files was deleted at port upgrade.

and upgrade to 3.0.17

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1# $Id: Portfile 75015 2011-01-11 17:12:39Z kimuraw@macports.org $
2
3PortSystem                      1.0
4name                            privoxy
5version                         3.0.17
6revision                        0
7categories                      www security net
8maintainers                     nomaintainer
9description                     Advanced filtering web proxy
10long_description \
11        Privoxy is a web proxy with advanced filtering capabilities for \
12        protecting privacy, modifying web page content, managing cookies, \
13        controlling access, and removing ads, banners, pop-ups and other \
14        obnoxious Internet junk. Privoxy has a very flexible configuration and \
15        can be customized to suit individual needs and tastes. Privoxy has \
16        application for both stand-alone systems and multi-user networks.
17
18platforms                       darwin
19
20homepage                        http://www.privoxy.org/
21master_sites            sourceforge:ijbswa
22distname                        ${name}-${version}-stable-src
23
24checksums           md5     9d363d738a3f3d73e774d6dfeafdb15f \
25                    sha1    cadef2eb8ec182278e092322d3d56f225cb69c93 \
26                    rmd160  8e4acc60ca7e7be20a92e1aece92eecedd4d1997
27
28worksrcdir                      ${name}-${version}-stable
29
30depends_lib                     port:pcre port:zlib
31
32set privoxyGroup        privoxy
33set privoxyUser         privoxy
34
35pre-configure {
36        addgroup        ${privoxyGroup}
37        adduser         ${privoxyUser} gid=[existsgroup ${privoxyGroup}]
38
39        system "cd ${worksrcpath} && autoheader"
40}
41pre-install {
42        addgroup        ${privoxyGroup}
43        adduser         ${privoxyUser} gid=[existsgroup ${privoxyGroup}]
44}
45
46use_autoconf            yes
47configure.args          --with-user=${privoxyUser} \
48                                        --with-group=${privoxyGroup} \
49                                        --sysconfdir=${prefix}/etc/${name} \
50                                        --mandir=${prefix}/share/man \
51                                        --enable-dynamic-pcre \
52                                        --enable-zlib
53
54destroot.keepdirs       ${destroot}${prefix}/var/log/privoxy \
55                                        ${destroot}${prefix}/var/run
56
57post-destroot {
58        xinstall -m 755 -d ${destroot}${prefix}/var/run
59        # Install and fixup startup script (if non-Darwin)
60        if {${os.platform} != "darwin"} {
61                xinstall -m 755 -d ${destroot}${prefix}/etc/rc.d
62                xinstall -m 755 -W ${worksrcpath} privoxy-generic.init \
63                        ${destroot}${prefix}/etc/rc.d/privoxy.sh
64
65                system "cd ${destroot}${prefix}/etc/rc.d && patch -p0 < ${filespath}/patch-privoxy.sh.diff"
66                reinplace "s|@@PREFIX@@|${prefix}|g" \
67                        ${destroot}${prefix}/etc/rc.d/privoxy.sh
68                reinplace "s|@@PRIVOXY_USER@@|${privoxyUser}|g" \
69                        ${destroot}${prefix}/etc/rc.d/privoxy.sh
70        }
71        # Rename these so local modifications are not removed on uninstall.
72        # NOTE: Always overwrite default.action and default.filter.
73        foreach privoxyConf {config match-all.action trust user.action user.filter} {
74            if [file exists ${destroot}${prefix}/etc/privoxy/${privoxyConf}] {
75                file rename ${destroot}${prefix}/etc/privoxy/${privoxyConf} \
76                        ${destroot}${prefix}/etc/privoxy/${privoxyConf}.new
77            }
78            # backup config files before fix #23970
79            if {[file exists ${prefix}/etc/privoxy/${privoxyConf}] \
80            && ![file exists ${prefix}/etc/privoxy/${privoxyConf}.new]} {
81                file copy ${prefix}/etc/privoxy/${privoxyConf} \
82                        ${destroot}${prefix}/etc/privoxy/${privoxyConf}.mp_backup
83            }
84        }
85        # Remove the preinstalled log files as, otherwise, a rotation script
86        # will fail when trying to rename and compress due to gzip not liking
87        # multi-linked files (the one in ${prefix} and the one in
88        # ${prefix}/var/db/dports/software/...)
89        eval file delete [glob ${destroot}${prefix}/var/log/privoxy/*]
90        # Make sure log directory owned by privoxy user/group
91        file attributes ${destroot}${prefix}/var/log/privoxy \
92                -group ${privoxyGroup} -owner ${privoxyUser}
93}
94
95post-activate {
96        # Make sure initial log files are present and setup correctly
97        foreach privoxyLog {jarfile logfile} {
98                touch ${prefix}/var/log/privoxy/${privoxyLog}
99                file attributes ${prefix}/var/log/privoxy/${privoxyLog} \
100                        -group ${privoxyGroup} -owner ${privoxyUser} \
101                        -permissions 0660
102        }
103        foreach privoxyConf {config match-all.action trust user.action user.filter} {
104                if ![file exists ${prefix}/etc/privoxy/${privoxyConf}] {
105                        # restore config files before fix #23970
106                        if [file exists ${prefix}/etc/privoxy/${privoxyConf}.mp_backup] {
107                            file copy ${prefix}/etc/privoxy/${privoxyConf}.mp_backup \
108                                    ${prefix}/etc/privoxy/${privoxyConf}
109                        } else {
110                            file copy ${prefix}/etc/privoxy/${privoxyConf}.new \
111                                    ${prefix}/etc/privoxy/${privoxyConf}
112                        }
113                        file attributes ${prefix}/etc/privoxy/${privoxyConf} \
114                                -group ${privoxyGroup} -owner ${privoxyUser} \
115                                -permissions 0660
116                }
117        }
118}
119
120platform darwin {
121        startupitem.create                      yes
122        startupitem.name                        Privoxy
123        startupitem.start                       "\[ -f \"${prefix}/etc/privoxy/config\" \] \\"
124        startupitem.start-append        "\t&& ${prefix}/sbin/privoxy \\"
125        startupitem.start-append        "\t\t--pidfile ${prefix}/var/run/privoxy.pid \\"
126        startupitem.start-append        "\t\t--user ${privoxyUser} \\"
127        startupitem.start-append        "\t\t${prefix}/etc/privoxy/config 2>/dev/null"
128        startupitem.stop                        "if \[ -f \"${prefix}/var/run/privoxy.pid\" \]; then"
129        startupitem.stop-append         "\tkill `cat ${prefix}/var/run/privoxy.pid` \\"
130        startupitem.stop-append         "\t\t&& rm -f ${prefix}/var/run/privoxy.pid"
131        startupitem.stop-append         "else"
132        startupitem.stop-append         "\t/usr/bin/killall -SIGUSR1 privoxy 2>/dev/null"
133        startupitem.stop-append         "fi"
134}
135
136livecheck.type          regex
137livecheck.url           http://www.privoxy.org/announce.txt
138livecheck.regex         Announcing Privoxy v.(\[0-9.\]+)
Note: See TracBrowser for help on using the repository browser.