crowdsec: Set tag version as expected by upstream (#377593)

authored by scrumplex.net and committed by GitHub 43760263 eabebda2

+12 -3
+12 -3
pkgs/by-name/cr/crowdsec/package.nix
··· 30 30 "-w" 31 31 "-X github.com/crowdsecurity/go-cs-lib/version.Version=v${version}" 32 32 "-X github.com/crowdsecurity/go-cs-lib/version.BuildDate=1970-01-01_00:00:00" 33 - "-X github.com/crowdsecurity/go-cs-lib/version.Tag=${src.rev}" 33 + "-X github.com/crowdsecurity/go-cs-lib/version.Tag=v${version}" 34 34 "-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=alphaga" 35 35 "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=/etc/crowdsec" 36 36 "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=/var/lib/crowdsec/data" ··· 42 42 mkdir -p $out/share/crowdsec 43 43 cp -r ./config $out/share/crowdsec/ 44 44 45 + mkdir -p $out/lib/systemd/system 46 + substitute ./config/crowdsec.service $out/lib/systemd/system/crowdsec.service \ 47 + --replace-fail /usr/local $out 48 + 45 49 installShellCompletion --cmd cscli \ 46 50 --bash <($out/bin/cscli completion bash) \ 47 51 --fish <($out/bin/cscli completion fish) \ ··· 49 53 ''; 50 54 51 55 # It's important that the version is correctly set as it also determines feature capabilities 52 - checkPhase = '' 53 - $GOPATH/bin/cscli version 2>&1 | grep -q "version: v${version}" 56 + preCheck = '' 57 + version=$($GOPATH/bin/cscli version 2>&1 | sed -nE 's/^version: (.*)/\1/p') 58 + 59 + if [ "$version" != "v${version}" ]; then 60 + echo "Invalid version string: '$version'" 61 + exit 1 62 + fi 54 63 ''; 55 64 56 65 meta = with lib; {