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

Last change on this file since 73361 was 73361, checked in by jmr@…, 9 years ago

privoxy: ensure user is created when installing from an archive (#20270)

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