# -*- 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               github 1.0

github.setup            rauchg wifi-password 0.1.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                1
platforms               {macosx any}
supported_archs         noarch
categories              sysutil security
maintainers             {i0ntempest @i0ntempest} openmaintainer
license                 MIT

description             Get the password of the wifi you're on
long_description        {*}${description}

checksums               rmd160  653ffccd4114f3fd756e4f44e00b9e3072910460 \
                        sha256  7ed783685ed43a94878d148346cba01428dbe1d99d463407be937d0f1b57c67c \
                        size    1848

depends_run-append      port:bash

patch.pre_args-replace  -p0 -p1
patchfiles-append       patch-aa8b59d3d7c45eef01f93b80fd998946b8ed57e7.diff

post-patch {
    # This script is not POSIX compliant
    reinplace "s|#!/usr/bin/env sh|#!${prefix}/bin/bash|" ${worksrcpath}/wifi-password.sh
    reinplace "s|echo|echo -e|g" ${worksrcpath}/wifi-password.sh
}

use_configure           no

build {}

destroot {
    xinstall ${worksrcpath}/wifi-password.sh ${destroot}${prefix}/bin/wifi-password
    file mkdir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} Readme.md ${destroot}${prefix}/share/doc/${name}
}
