# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem      1.0
PortGroup       github 1.0

github.setup    hypriot flash 2.7.2
github.tarball_from archive
revision        0

platforms       any
supported_archs noarch
categories      sysutils
license         MIT
maintainers     @jrjsmrtn openmaintainer

description     Command line script to flash SD card images of any kind
long_description    {*}${description}

checksums       rmd160  79515fe8602204971a29499ac5705b55668383b6 \
                sha256  2d6b40158a277c77d8f9aabbb7d8ff4e4ae4f61b62107be83e69a430b3208c54 \
                size    18075

depends_run     port:unzip \
                port:curl \
                port:pv

notes           "If you want to flash directly from an AWS S3 bucket,\
                install awscli for your python, e.g. py314-awscli."

use_configure   no

build           {
    reinplace "s|dirty|${github.version}|g" ${worksrcpath}/flash
}

destroot {
    xinstall -m 755 ${worksrcpath}/flash ${destroot}${prefix}/bin

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} AUTHORS LICENSE README.md \
        ${destroot}${prefix}/share/doc/${name}
    file copy ${worksrcpath}/sample \
        ${destroot}${prefix}/share/doc/${name}
}
