# -*- 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
PortGroup               openssl 1.0

openssl.branch          1.1

name                    makuosan
version                 1.3.6
revision                0
license                 GPL-3
homepage                https://sourceforge.net/projects/makuosan \
                        https://github.com/yasui0906/makuosan
categories              net
maintainers             nomaintainer

description \
    Makuosan(MAKUO for short) is a software which transfer files to multiple servers simultaneously using UDP multicast.

long_description \
    Makuosan(MAKUO for short) is a software which transfer files to multiple servers simultaneously using UDP multicast. \
(MAKUO consists of makuosan daemon and command line utility msync. The makuosan should be run on every server in a cluster. The makuo talk to makuosan daemon.) MAKUO has following features\; \
 Scalability: \
The time required to transfer files to multiple servers does not depend on the number of the target servers. It takes almost as same amount of time to transfer files to 20 servers as it does to 10 servers. However, it is desirable to use MAKUO among servers with similar performance, because transfer speed is limited by the slowest server. \
 Simultaneous update on every server. \
The makuosan transfers files simultaneously using IP multicast. Therefore, there should not be any out of sync server. \
 Simple configuration: \
Each makuosan daemon maintains available server list by periodically checking existence of other makuosan daemons on different servers. \
The makuosan transfers files only to those servers where makuosan daemon is also alive. Therefore, it never stalls waiting for a dead server, or timeouts.

master_sites            sourceforge

checksums               rmd160  01bd8bceea930b64719cb769b4a66a058fd4c8a3 \
                        sha256  f3be10d1dcaa2fbd16c40761af722cda67c96d69f71c94c8d619b1f27755db23 \
                        size    148535

variant server description {add a startup item} {
    set pidfile       ${prefix}/var/run/${name}.pid
    set makuosan_sbin ${prefix}/sbin/${name}

    # Create a startupitem to start/stop the server
    startupitem.create  yes
    startupitem.init    "PIDFILE=${pidfile}"
    startupitem.start   "\[ -f ${prefix}/etc/makuosanrc \] && . ${prefix}/etc/makuosanrc && ${makuosan_sbin} -b \${BASE_DIR} -p \${PORT} -l \${IP_ADDRESS} && /bin/ps -ax | /usr/bin/grep ${makuosan_sbin} | /usr/bin/grep -v grep | /usr/bin/awk '{ print \$1 }' > \${PIDFILE}"
    startupitem.stop    "\[ -r \${PIDFILE} \] && /bin/kill \$(cat \${PIDFILE}) && /bin/rm -f \${PIDFILE}"
}

pre-destroot {
    xinstall -m 755 ${filespath}/makuosanrc.in ${destroot}${prefix}/etc/makuosanrc.sample
}

post-install {
    if { [variant_isset server] } {
        ui_msg "******************************************************"
        ui_msg "*"
        ui_msg "* First, copy makuosan's base directory setting."
        ui_msg "* \$ sudo cp ${prefix}/etc/makuosanrc.sample ${prefix}/etc/makuosanrc"
        ui_msg "*"
        ui_msg "******************************************************"
    }
}
