Ticket #39435: Portfile-clamav.diff

File Portfile-clamav.diff, 2.6 KB (added by mroman@…, 11 years ago)
  • Portfile

    old new  
    3838                        configure.cflags {-O0}
    3939                }
    4040
     41if {"darwin" == ${os.platform} && ${os.major} > 8} {
     42    set clamavuser      _clamav
     43} else {
     44    set clamavuser      clamav
     45}
     46add_users ${clamavuser} group=${clamavuser} realname=clamav
     47
     48
    4149post-destroot {
     50                        xinstall -d -o ${clamavuser} -g ${clamavuser} -m 755 ${destroot}${prefix}/share/clamav
     51                       
     52                        reinplace "/^Example.*$/d" "${destroot}${prefix}/etc/freshclam.conf"
     53                        reinplace "s|^#NotifyClamd .*$|NotifyClamd ${prefix}/etc/clamd.conf|" "${destroot}${prefix}/etc/freshclam.conf"
     54                        reinplace "s|^#PidFile .*$|#PidFile ${prefix}/var/run/freshclam.pid|" "${destroot}${prefix}/etc/freshclam.conf"
     55                        reinplace "s|^#UpdateLogFile .*$|#UpdateLogFile ${prefix}/var/log/freshclam.log|" "${destroot}${prefix}/etc/freshclam.conf"
     56                       
     57                        reinplace "/^Example.*$/d" "${destroot}${prefix}/etc/clamd.conf"
     58                        reinplace "s|^#Foreground .*$|Foreground yes|" "${destroot}${prefix}/etc/clamd.conf"
     59                        reinplace "s|^#PidFile .*$|PidFile ${prefix}/var/run/clamd.pid|" "${destroot}${prefix}/etc/clamd.conf"
     60                        reinplace "s|^#LocalSocket .*$|LocalSocket ${prefix}/var/run/clamd.socket|" "${destroot}${prefix}/etc/clamd.conf"
     61                        reinplace "s|^#LogFile .*$|#LogFile ${prefix}/var/log/clamd.log|" "${destroot}${prefix}/etc/clamd.conf"
     62                       
     63                        file attributes ${destroot}${prefix}/bin/freshclam -group ${clamavuser} -owner ${clamavuser} -permissions 06755
     64                       
     65                       
    4266                        file rename "${destroot}${prefix}/etc/freshclam.conf" "${destroot}${prefix}/etc/example-freshclam.conf"
    4367                        file rename "${destroot}${prefix}/etc/clamd.conf" "${destroot}${prefix}/etc/example-clamd.conf"
    4468
     
    5377                                reinplace "s|-arch ${build_arch}||g" ${destroot}${prefix}/bin/clamav-config
    5478                                reinplace "s|-L\$\{exec_prefix\}/lib/${build_arch}||g" ${destroot}${prefix}/bin/clamav-config
    5579                                }
    56                         }
     80                }
     81       
     82destroot.keepdirs ${destroot}${prefix}/share/clamav
     83
     84post-activate {
     85        if {![file exists ${prefix}/etc/clamd.conf]} {
     86                file copy ${prefix}/etc/example-clamd.conf ${prefix}/etc/clamd.conf
     87        }
     88        if {![file exists ${prefix}/etc/freshclam.conf]} {
     89                file copy ${prefix}/etc/example-freshclam.conf ${prefix}/etc/freshclam.conf
     90        }
     91}
    5792
    5893variant clamav_milter description {build with libmilter support} {
    5994                        depends_lib-append port:libmilter
     
    6398                                }
    6499                        }
    65100
     101
     102
    66103livecheck.type          regex
    67104livecheck.url           http://sourceforge.net/projects/clamav/files
    68105livecheck.regex         ${name}-(\\d+.\\d+.\\d+)${extract.suffix}