fix: use try-restart in postinst so .deb upgrade reloads the service

- Bump VERSION 0.1.6 -> 0.1.7
- Change systemctl start -> try-restart in postinst script so that
  upgrading the package actually restarts nasctl with the new binary
This commit is contained in:
2026-07-05 23:14:31 -04:00
parent ac07499e8d
commit a61ae04009
3 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
BINARY=nasctl
VERSION?=0.1.6
VERSION?=0.1.7
GO?=go
LDFLAGS=-s -w -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION) -X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_FLAGS=CGO_ENABLED=0
@@ -32,7 +32,7 @@ package: build-all
cp bin/$(BINARY)-linux-amd64 dist/deb/usr/local/bin/$(BINARY)
cp systemd/nasctl.service dist/deb/etc/systemd/system/$(BINARY).service
printf 'Package: nasctl\nVersion: $(VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: nasctl\nDescription: Monolithic NAS control plane\n' > dist/deb/DEBIAN/control
printf '#!/bin/sh\nset -e\ninstall -d /var/lib/nasctl\nsystemctl daemon-reload\nsystemctl enable nasctl.service || true\nsystemctl start nasctl.service\n' > dist/deb/DEBIAN/postinst
printf '#!/bin/sh\nset -e\ninstall -d /var/lib/nasctl\nsystemctl daemon-reload\nsystemctl enable nasctl.service || true\nsystemctl try-restart nasctl.service\n' > dist/deb/DEBIAN/postinst
chmod 0755 dist/deb/DEBIAN/postinst
dpkg-deb --build dist/deb dist/nasctl_$(VERSION)_amd64.deb