Browse Source

Added installation script and improved release part, fixes #2

master
Darshil Chanpura 2 years ago
parent
commit
f5e8a0612b
  1. 9
      Makefile
  2. 14
      scripts/install.sh

9
Makefile

@ -22,8 +22,11 @@ test:
$(ARCHS):
GOARCH=$(arch) GOOS=$(PLATFORM) go build -ldflags '-s -w -X main.version=$(VERSION)' -o release/$(BINARY)
tar -czf release/$(BINARY)-$(VERSION)-linux-$(arch).tar.gz README.md -C release/ $(BINARY)
GOARCH=$(arch) GOOS=$(PLATFORM) go build -ldflags '-s -w -X main.version=$(VERSION)' -o release/$(BINARY) ./cmd/$(BINARY)
tar -cf release/$(BINARY)-$(VERSION)-linux-$(arch).tar README.md -C release $(BINARY)
tar -uf release/$(BINARY)-$(VERSION)-linux-$(arch).tar -C scripts install.sh
tar -uf release/$(BINARY)-$(VERSION)-linux-$(arch).tar -C init/systemd shutdown-tool.service
gzip -f release/$(BINARY)-$(VERSION)-linux-$(arch).tar
rm release/$(BINARY)
.PHONY: release
@ -32,4 +35,4 @@ release: arm arm64 amd64
clean:
rm -rf release/*
all: bootstrap test release
all: bootstrap test release

14
scripts/install.sh

@ -0,0 +1,14 @@
#!/bin/bash
if [[ `id -u` -ne 0 ]]; then
echo "Script should be run using root or try running it as sudo $0"
exit -1
fi
install ./shutdown-tool /usr/local/bin
install ./shutdown-tool.service /etc/systemd/system
systemctl enable shutdown-tool
systemctl start shutdown-tool
firewall-cmd --add-port=8001/tcp --permanent
firewall-cmd --reload
Loading…
Cancel
Save