fixes after review

This commit is contained in:
anastasia prasolova 2019-11-07 14:57:02 +03:00
parent 95345b673a
commit a00275bebd
2 changed files with 20 additions and 13 deletions

View file

@ -2,6 +2,11 @@ BRANCH = "master"
REPONAME = "neo-go" REPONAME = "neo-go"
NETMODE ?= "privnet" NETMODE ?= "privnet"
BINARY = "./bin/neo-go" BINARY = "./bin/neo-go"
DESTDIR = ""
SYSCONFIGDIR = "/etc"
BINDIR = "/usr/bin"
SYSTEMDUNIT_DIR = "/lib/systemd/system"
UNITWORKDIR = "/var/lib/neo-go"
REPO ?= "$(shell go list -m)" REPO ?= "$(shell go list -m)"
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
@ -20,19 +25,21 @@ build: deps
&& go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go
install: build install: build
@echo "=> Preparing directories and configs"
@id neo-go || useradd -s /usr/sbin/nologin -d /var/lib/neo-go neo-go \
&& mkdir -p /var/lib/neo-go \
&& chown -R neo-go:neo-go /var/lib/neo-go
@echo "=> Installing systemd service" @echo "=> Installing systemd service"
@mkdir -p /etc/neo-go \ @mkdir -p $(DESTDIR)$(SYSCONFIGDIR)/neo-go \
&& mkdir -p /etc/systemd/system/ \ && mkdir -p $(SYSTEMDUNIT_DIR) \
&& cp ./neo-go.service /etc/systemd/system/ \ && cp ./neo-go.service $(SYSTEMDUNIT_DIR) \
&& cp ./config/protocol.mainnet.yml /etc/neo-go \ && cp ./config/protocol.mainnet.yml $(DESTDIR)$(SYSCONFIGDIR)/neo-go \
&& systemctl enable neo-go.service \ && cp ./config/protocol.privnet.yml $(DESTDIR)$(SYSCONFIGDIR)/neo-go \
&& mv ./bin/neo-go /usr/local/bin/neo-go \ && cp ./config/protocol.testnet.yml $(DESTDIR)$(SYSCONFIGDIR)/neo-go \
&& chown neo-go:neo-go /usr/local/bin/neo-go && install -m 0755 -t $(BINDIR) $(BINARY) \
@echo "Done. Start Neo Go with 'systemctl start neo-go.service'"
postinst: install
@echo "=> Preparing directories and configs"
@id neo-go || useradd -s /usr/sbin/nologin -d $(UNITWORKDIR) neo-go \
&& mkdir -p $(UNITWORKDIR) \
&& chown -R neo-go:neo-go $(UNITWORKDIR) $(BINDIR)/neo-go \
&& systemctl enable neo-go.service
image: image:
@echo "=> Building image" @echo "=> Building image"

View file

@ -4,7 +4,7 @@ Requires=network.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/local/bin/neo-go node --mainnet --config-path=/etc/neo-go ExecStart=/usr/bin/neo-go node --mainnet --config-path=/etc/neo-go
User=neo-go User=neo-go
Group=neo-go Group=neo-go
Restart=always Restart=always