# -*- 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.1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
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  a6766670fef1f0152c7109d1ed8fa1d051e9183c \
                sha256  ff727ccd7042c95a26093fb528bb2a9b0b1d2e71c1b3fa9ced459315a02273a2 \
                size    18080

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

notes           "If you want to flash directly from an AWS S3 bucket,\
                install the py38-awscli port."

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}
}
