# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 83385 2011-08-31 01:52:26Z dports@macports.org $

PortSystem          1.0

name                miredo
version             1.2.2
revision            1
maintainers         mnick

categories          net
description         Miredo is an open-source Teredo IPv6 tunneling software
long_description    ${description}. \
                    It includes functional implementations of all components of the Teredo \
                    specification (client, relay and server). It is meant to provide IPv6 \
                    connectivity even from behind NAT devices

platforms           darwin
license             GPL-2

homepage            http://www.remlab.net/miredo/
master_sites        http://www.remlab.net/files/miredo/

use_bzip2           yes

checksums           md5     a04a40c4b42869968e00495636ff6d82 \
                    sha1    9facd2ef23ae7a9969dfbe179a6c3ebddd87a2cc \
                    rmd160  16c9ec08d5ae935027a49153dc44745e2cc916c7

patchfiles          patch-nosignal.diff
use_parallel_build  no

depends_lib-append  port:judy port:tuntaposx

# run as miredo user
set miredo_user     miredo
set miredo_group    miredo
configure.args-append   --enable-miredo-user

startupitem.create      yes
startupitem.executable  ${prefix}/sbin/miredo -c ${prefix}/etc/miredo/miredo.conf \
                            -p ${prefix}/var/run/${name}.pid --foreground

post-destroot {
    # Renaming of interface isn't supported
    reinplace "s|^InterfaceName|#InterfaceName|" ${destroot}${prefix}/etc/miredo/miredo.conf

    # Create user and group
    addgroup ${miredo_group}
    adduser ${miredo_user} gid=[existsgroup ${miredo_group}]
}

livecheck.type  regex
livecheck.url   ${master_sites}
livecheck.regex <a href=\"${name}-(.*)${extract.suffix}\">
