Ticket #44833: patch-sguil-client-Portfile.diff

File patch-sguil-client-Portfile.diff, 6.5 KB (added by jul_bsd@…, 10 years ago)
  • security/sguil-client/Portfile

    old new  
     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
    12# $Id: Portfile 104513 2013-03-26 13:11:13Z jmr@macports.org $
    23
    34PortSystem 1.0
    45
    5 name                    sguil-client
    6 version                 0.6.1
    7 revision        1
    8 categories              security net
    9 license                 QPL-1 Permissive
    10 maintainers             nomaintainer
    11 description             GUI Console for Sguil Network Security Monitor
    12 long_description        ${description}
    13 platforms               darwin
    14 supported_archs noarch
    15 homepage                http://sguil.sf.net
    16 master_sites            sourceforge:sguil
    17 checksums               md5 68d209f882d4c8fa9c200ba0924b00b3
    18 worksrcdir              sguil-${version}
    19 depends_build           port:itcl \
    20                         port:tclx \
    21                         port:itk \
    22                         port:iwidgets \
    23                         port:tcllib \
    24                         port:tcl-tls \
    25                         port:openssl
     6PortGroup           github 1.0
    267
    27 use_configure           no
     8github.setup        bammv sguil 0.9.0
     9name                sguil-client
     10#version            0.9.0
     11categories         security net
     12license            QPL-1 Permissive
     13maintainers        nomaintainer
     14description        GUI Console for Sguil Network Security Monitor
     15long_description    ${description}
     16platforms        darwin
     17supported_archs    noarch
     18homepage        https://bammv.github.io/sguil/
     19#master_sites        sourceforge:sguil
     20master_sites    https://github.com/bammv/sguil/archive/
     21distname        v${version}
     22
     23worksrcdir        sguil-${version}
     24
     25checksums           rmd160  b01425bcbe20fcce51f6ad73f88482ddfa2a811f \
     26                    sha256  412be894d67a6487312dd16a98a580dda8c38cff2e24f7a6c25405857769782b
     27
     28depends_build        port:itcl \
     29            port:tclx \
     30            port:itk \
     31            port:iwidgets \
     32            port:tcllib \
     33            port:tcl-tls \
     34            port:openssl
     35
     36use_configure        no
    2837build {}
    2938
    3039post-patch {
    31         reinplace "s|set SGUILLIB ./lib|set SGUILLIB ${prefix}/lib/sguil|g" \
    32                 ${worksrcpath}/client/sguil.conf
    33         reinplace "s|set ETHEREAL_PATH /usr/sbin/ethereal|set ETHEREAL_PATH ${prefix}/bin/ethereal|g" \
     40    reinplace "s|set SGUILLIB ./lib|set SGUILLIB ${prefix}/lib/sguil|g" \
     41        ${worksrcpath}/client/sguil.conf
     42    reinplace "s|set ETHEREAL_PATH /usr/sbin/ethereal|set ETHEREAL_PATH ${prefix}/bin/ethereal|g" \
    3443                ${worksrcpath}/client/sguil.conf
    35         reinplace "s|set SERVERHOST demo.sguil.net|set SERVERHOST localhost|g" \
     44    reinplace "s|set SERVERHOST demo.sguil.net|set SERVERHOST localhost|g" \
    3645                ${worksrcpath}/client/sguil.conf
    37         reinplace "s|set MAILSERVER mail.example.com|set MAILSERVER localhost|g" \
     46    reinplace "s|set MAILSERVER mail.example.com|set MAILSERVER localhost|g" \
    3847                ${worksrcpath}/client/sguil.conf
    3948}
    4049
     
    4554set sguildoc  ${prefix}/share/doc/sguil
    4655set sguiletc  ${prefix}/etc/sguil
    4756
    48         xinstall -m 755 -d ${destroot}${sguilbin}
    49         xinstall -m 755 ${worksrcpath}/client/sguil.tk ${destroot}${sguilbin}
    50         xinstall -m 755 -d ${destroot}${sguillib}
    51         system "cp -R ${worksrcpath}/client/lib/* ${destroot}${sguillib}"
    52         xinstall -m 755 -d ${destroot}${sguildoc}
    53         system "cp ${worksrcpath}/doc/* ${destroot}${sguildoc}"
    54         xinstall -m 755 -d ${destroot}${sguiletc}
    55         xinstall -m 755 ${worksrcpath}/client/sguil.conf ${destroot}${sguiletc}/sguil.conf.sample
     57    xinstall -m 755 -d ${destroot}${sguilbin}
     58    xinstall -m 755 ${worksrcpath}/client/sguil.tk ${destroot}${sguilbin}
     59    xinstall -m 755 -d ${destroot}${sguillib}
     60    system "cp -R ${worksrcpath}/client/lib/* ${destroot}${sguillib}"
     61    xinstall -m 755 -d ${destroot}${sguildoc}
     62    system "cp ${worksrcpath}/doc/* ${destroot}${sguildoc}"
     63    xinstall -m 755 -d ${destroot}${sguiletc}
     64    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
     65    xinstall -m 644 ${worksrcpath}/client/sguil.conf ${destroot}${prefix}/share/examples/${name}/
     66
     67    if {${subport} eq "sguil-server"} {
     68        xinstall -m 755 ${worksrcpath}/server/sguild ${destroot}${prefix}/sbin/
     69        xinstall -m 755 -d ${destroot}${prefix}/share/sguild
     70        copy ${worksrcpath}/server/lib ${destroot}${prefix}/share/sguild/
     71
     72        xinstall -m 755 -d ${destroot}${prefix}/share/examples/sguild
     73        copy ${worksrcpath}/server/sql_scripts ${destroot}${prefix}/share/examples/sguild/
     74        foreach f { sguild.conf sguild.users sguild.queries sguild.access } {
     75            xinstall -m 644 ${worksrcpath}/server/${f} ${destroot}${prefix}/share/examples/sguild/
     76        }
     77    }
     78}
     79
     80post-activate {
     81    if {${subport} eq "sguil-client"} {
     82        if ![file exists ${sguiletc}/sguil.conf ] {
     83            copy ${prefix}/share/examples/${name}/sguil.conf ${sguiletc}/
     84        }
     85    }
     86    if {${subport} eq "sguil-server"} {
     87        foreach f { sguild.conf sguild.users sguild.queries sguild.access } {
     88            if ![file exists ${prefix}/etc/sguild/${f} ] {
     89                copy ${prefix}/share/examples/sguild/${f} ${prefix}/etc/sguild/
     90            }
     91        }
     92    }
     93}
     94
     95if {${subport} eq ${name}} {
     96   
     97    conflicts          ${name}-devel
     98   
     99}
     100
     101subport ${name}-devel {
     102    fetch.type git
     103    git.url    https://github.com/bammv/sguil.git
     104    version    20140813
     105    git.branch b708fa838722ac6cd8c006d3d6587e800ef14e67
     106
     107    conflicts          ${name}
     108   
     109    livecheck.type     none
    56110}
     111
     112subport sguil-server {
     113    ## variant ?
     114    depends_run-append  port:mysql56-server port:mysqltcl
     115
     116    add_users sguil group=sguil home=${prefix}/var/db/sguil shell=/sbin/nologin realname=sguil\ user
     117
     118    notes-append "
     119*** To install sguil server ***
     120
     1211) Install and create sguil database
     122
     123    shell> mysql -u root -p mysql
     124    mysql> GRANT ALL PRIVILEGES ON sguildb.*
     125                 TO sguil@localhost IDENTIFIED BY 'sguilpasswd';
     126    mysql> FLUSH PRIVILEGES;
     127
     128    $ mysql -u sguil -p -e \"CREATE DATABASE sguildb\"
     129    $ mysql -u sguil -p -D sguildb < ./server/sql_scripts/create_sguildb.sql
     130
     1312) Install the GUI server (sguild)
     132    ?port select --list tclsh       NOK
     133
     134    Check ${prefix}/etc/sguild files especially snort rules path.
     135    Add user:
     136    $ sguild -adduser <username>
     137
     138"
     139
     140    startupitem.create      yes
     141    startupitem.name        sguild
     142    startupitem.executable  "${prefix}/bin/sguild -D"
     143}
     144
     145notes-append "
     146
     147*** To finish sguil install ***
     148
     1493) Install the GUI client (sguil.tk)
     1504) Install the sensor
     151
     152"
     153
     154livecheck.type     regex
     155livecheck.url       ${homepage}
     156livecheck.regex     ">Sguil (\\d+(?:\\.\\d+)*)"