From 2afb1851d616e82d0debdf53dc4ecb67247444c7 Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Wed, 13 Nov 2019 15:05:13 +0300 Subject: [PATCH] service file templating --- Makefile | 5 ++++- neo-go.service => neo-go.service.template | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) rename neo-go.service => neo-go.service.template (69%) diff --git a/Makefile b/Makefile index 041dd003a..02eb1966a 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,10 @@ build: deps && export CGO_ENABLED=0 \ && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go -install: build +neo-go.service: neo-go.service.template + @sed -r -e 's_BINDIR_$(BINDIR)_' -e 's_UNITWORKDIR_$(UNITWORKDIR)_' -e 's_SYSCONFIGDIR_$(SYSCONFIGDIR)_' $< >$@ + +install: build neo-go.service @echo "=> Installing systemd service" @mkdir -p $(DESTDIR)$(SYSCONFIGDIR)/neo-go \ && mkdir -p $(SYSTEMDUNIT_DIR) \ diff --git a/neo-go.service b/neo-go.service.template similarity index 69% rename from neo-go.service rename to neo-go.service.template index 88191555c..4d919e6a9 100644 --- a/neo-go.service +++ b/neo-go.service.template @@ -4,7 +4,7 @@ Requires=network.target [Service] Type=simple -ExecStart=/usr/bin/neo-go node --mainnet --config-path=/etc/neo-go +ExecStart=BINDIR/neo-go node --mainnet --config-path=SYSCONFIGDIR/neo-go User=neo-go Group=neo-go Restart=always @@ -12,7 +12,7 @@ RestartSec=5 StandardError=syslog SyslogIdentifier=neo-go PrivateTmp=true -WorkingDirectory=/var/lib/neo-go +WorkingDirectory=UNITWORKDIR [Install] WantedBy=multi-user.target