# -*- 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

PortSystem 1.0

name            dansguardian
version         2.12.0.3
categories      net
platforms       darwin
license         GPL-2
maintainers     nomaintainer
description     web content filter
long_description	DansGuardian is content-control software: software \
			designed to control which websites users can access.\
			It also includes virus filtering and usage monitoring features. 

homepage        http://dansguardian.org/ 
master_sites    sourceforge:project/dansguardian

checksums           md5     2a88d0392cd28eaec02b7ee727b2e253 \
                    sha1    c5d8175910310f9a03efc2e6cb440ea418adb896 \
                    rmd160  312db0ce2db9d1b2ed537807f9b2eca5d76a4123

use_bzip2	yes

depends_build   port:pkgconfig
depends_lib	port:zlib \
		port:pcre \
		port:libiconv 
				
configure.args  --enable-pcre \
		--enable-avastd \
		--enable-kavd \
		--enable-clamd \
		--enable-ntlm

startupitem.create	yes
startupitem.name	dansguardian
startupitem.executable	${prefix}/sbin/dansguardian -N

post-activate {
    set log_path ${prefix}/var/log/dansguardian
    if {[getuid] == 0} {
        set runas_user nobody
        set runas_group nobody

        xinstall -d ${prefix}/var/log
        xinstall -d -o ${runas_user} -g ${runas_group} -m 755 ${log_path}
        fs-traverse file [list ${log_path}] {
            if {[file isdirectory ${file}]} {
                file attributes ${file} -group ${runas_group} -owner ${runas_user} -permissions 00755
            } else {
                file attributes ${file} -group ${runas_group} -owner ${runas_user} -permissions 00644
            }
        }
    } else {
        xinstall -d ${log_path}
    }
}

livecheck.regex	${name}-(\[\\d\\.\]+\\d)
