From 6d1adb1784c71f9a8abe54addb63faf6f1f3d051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kerma=20G=C3=A9rald?= Date: Tue, 1 Feb 2022 17:16:17 +0100 Subject: [PATCH] Makefile: add ENV VARIABLES to override /etc/crowdsec and /var/lib/crowdsec/data (#1224) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to enhance: https://github.com/crowdsecurity/crowdsec/commit/35eea39db7736e03030d2fd351f40e30207d808f - add ENV VARIABLES to help defaults settings from script build (without hardcoded patch need) - add override also in static build Signed-off-by: Kerma GĂ©rald --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 888b85ba8..49e75a84e 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ BUILD_GOVERSION="$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')" BUILD_CODENAME=$(shell cat RELEASE.json | jq -r .CodeName) BUILD_TIMESTAMP=$(shell date +%F"_"%T) BUILD_TAG?="$(shell git rev-parse HEAD)" +DEFAULT_CONFIGDIR ?= "/etc/crowdsec" +DEFAULT_DATADIR ?= "/var/lib/crowdsec/data" export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.System=$(SYSTEM) \ @@ -51,14 +53,16 @@ export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversio -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION) \ --X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=/etc/crowdsec \ --X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=/var/lib/crowdsec/data" +-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \ +-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)" export LD_OPTS_STATIC=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION) \ +-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \ +-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR) \ -extldflags '-static'" RELDIR = crowdsec-$(BUILD_VERSION)