-
Notifications
You must be signed in to change notification settings - Fork 332
Closed
Labels
Description
Ran into 2 minor issue with the do.sh script on FreeBSD.
uname -a
FreeBSD syslogserver.cidercreekranch.net 12.2-RELEASE-p2 FreeBSD 12.2-RELEASE-p2 663e6b09467(HEAD) TRUENAS amd64
- The do.sh script uses a shebang of #!/bin/bash, but on FreeBSD bash is found at /usr/local/bin/bash. To get around this problem I change the shebang to:
$!/usr/bin/env bash
- The hostname command on FreeBSD does not support the -fqdn switch. The same results can be achieved by simply calling hostname without switches.
I added an OS test in the build function which allowed the build to complete.
build () {
local VERSION=$(git describe --always --long)
local DT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO-8601
#-- Added OS test for FreeBSD
if [ $(uname) = "FreeBSD" ]; then
local FQDN=$(hostname)
else
local FQDN=$(hostname --fqdn)
fi
local SEMVER=$(git tag --list --sort="v:refname" | tail -n -1)
local BRANCH=$(git rev-parse --abbrev-ref HEAD)
go build -i -v -ldflags=" -X main.version=${VERSION} -X main.builddt=${DT} -X main.host=${FQDN} -X main.semver=${SEMVER} -X main.branch=${BRANCH}" .
}
Reactions are currently unavailable