:

_build()
{
    ARCH="amd64"

    for a in $ARCH
    do

        CGO_ENABLED=0 GOOS=linux GOARCH=$a go build -ldflags '-w -s' -o bin/$a src/main.go && 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 -f etc/gomail.ini /etc/
}


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