:

_build()
{
    ARCH="386 amd64 arm arm64 mips mips64 mips64le mipsle ppc64 ppc64le"

    for a in $ARCH
    do

        CGO_ENABLED=0 GOOS=linux GOARCH=$a go build -ldflags '-w -s' -o bin/$a && upx -9 bin/$a
    done

}

_install()
{
    ARCH=`go env | grep GOARCH | cut -d \"  -f 2`
    cp bin/${ARCH} /bin/gomail
    chmod +x /bin/gomail
    cp gomail.ini /etc/
}


test "$1" = "install" && _install && exit 0
_build
