Ticket #38461: mod_hfs_apple-portfile-20130910-with-notauto

File mod_hfs_apple-portfile-20130910-with-notauto, 2.8 KB (added by mp@…, 11 years ago)

Portfile with variant +notauto – to not automatically modify apache2 configuration files

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
5
6name                    mod_hfs_apple
7version                 14
8categories              www
9platforms               darwin
10maintainers             nomaintainer
11description             mod_hfs_apple is an apache2 module to fix some pecularities with HFS
12long_description        Apache module (to enforce casing in URLs which need it).\
13                          Version 14 also prevents vulnerabilities like "index.p%E2%80%8Chp" access.
14
15set aname apache_${name}
16license                 APSL-2
17distname                ${aname}-${version}
18homepage                http://opensource.apple.com/source/${aname}/
19master_sites            http://opensource.apple.com/tarballs/${aname}
20worksrcdir              ${distname}
21
22checksums               rmd160  1d3605e9a35f111ed076d03cb9791760b77bfbb4 \
23                        sha256  9b9b1896829e5eba0864d1539b4c57a071cff3fc6ccdf8757b89efc2ebf7e4e6
24
25depends_lib             port:apache2
26
27set apath ${prefix}/apache2
28set amods ${apath}/modules
29
30use_configure           no
31
32build.cmd               ${apath}/bin/apxs
33build.target
34build.args              -c -Wc,\" -Wall -Wextra -Os -g\" \
35                           -Wl,\" -framework CoreFoundation\" \
36                           -o ${name}.so ${name}2.c
37
38destroot.violate_mtree  yes
39
40destroot {
41    xinstall -m 755 -d ${destroot}${amods}
42    xinstall -m 644 ${worksrcpath}/.libs/${name}.so ${destroot}${amods}
43}
44
45variant notauto description { Manually add ${name} to ${apath}/conf/httpd.conf and restart apache2 } {
46}
47
48if {[variant_isset notauto]} {
49    notes "The variant +notauto is being used, so,
50after installation/activation,
51${apath}/bin/apxs -e -a -n \"hfs_apple\" ${amods}/${name}.so
52needs to be run, or the line
53---
54LoadModule hfs_apple_module modules/mod_hfs_apple.so
55---
56manually added to the apache2 configuration file
57${apath}/conf/httpd.conf
58and then the command
59---
60${apath}/bin/apachectl -k graceful
61---
62issued to restart the apache2 server.
63
64If ${name} is ever deactivated/uninstalled,
65the above mentioned line in the configuration file
66will be commented out - for apache2 to start -
67but apache2 should be restarted manually."
68} else {
69    notes "Activation/deactivation is done automagically (with apxs and apachectl)."
70}
71
72post-activate {
73    if {![variant_isset notauto]} {
74        ui_msg "Activating ${name} in the apache2 configuration"
75        system "${apath}/bin/apxs -e -a -n \"hfs_apple\" ${amods}/${name}.so"
76        ui_msg "Restarting apache2 gracefully"
77        system "${apath}/bin/apachectl -k graceful"
78        ui_msg "apache2 is now secure on HFS"
79    }
80}
81
82pre-deactivate {
83    ui_msg "Commenting out ${name} from the apache2 configuration file"
84    system "${apath}/bin/apxs -e -A -n \"hfs_apple\" ${amods}/${name}.so"
85    if {![variant_isset notauto]} {
86        ui_msg "Restarting apache2 gracefully"
87        system "${apath}/bin/apachectl -k graceful"
88        ui_msg "apache2 on HFS is not secure anymore"
89    }
90}