From 8b6b4d582d330e6a3aef5c16062a0cb652498ac0 Mon Sep 17 00:00:00 2001 From: Levi Woodard Date: Sun, 26 Apr 2026 14:00:43 -0600 Subject: [PATCH] Adding make reinstall --- Makefile | 90 +++++++++++++++++++++++++++++++++++++++++- README.md | 27 +++++++++++++ cmd/streamdeck/main.go | 2 +- 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c2320e5..828a685 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ else UDEV_RULE := /etc/udev/rules.d/99-streamdeck.rules endif -.PHONY: build build-helper build-init install install-helper install-watchdog uninstall uninstall-helper uninstall-watchdog udev +.PHONY: build build-helper build-init install install-helper install-watchdog reinstall uninstall uninstall-helper uninstall-watchdog udev # ── Build ───────────────────────────────────────────────────────────────────── @@ -135,6 +135,94 @@ else fi endif +# ── Reinstall ───────────────────────────────────────────────────────────────── +# Refresh only the pieces that are already installed: binary, service unit, +# helper, watchdog, and modules.yaml. Skips dependency/dotfile/symlink setup. +# Use this after a code change to redeploy without going through install.sh. + +ifeq ($(OS),Darwin) +reinstall: build + @echo " ━━━ streamdeck-go reinstall ━━━" + @if [ -f $(BIN_DIR)/$(BINARY) ]; then \ + install -m 755 $(BINARY) $(BIN_DIR)/$(BINARY); \ + echo " ✓ binary → $(BIN_DIR)/$(BINARY)"; \ + else \ + echo " · binary not installed (skipping — run 'make install' first)"; \ + fi + @if [ -f $(AGENT_PLIST) ]; then \ + LOG_PATH="$$HOME/Library/Logs/streamdeck-go.log"; \ + sed -e "s|STREAMDECK_BINARY_PATH|$(BIN_DIR)/$(BINARY)|g" \ + -e "s|STREAMDECK_LOG_PATH|$$LOG_PATH|g" \ + launchd/com.woodarddigital.streamdeck-go.plist > $(AGENT_PLIST); \ + launchctl unload $(AGENT_PLIST) 2>/dev/null || true; \ + launchctl load $(AGENT_PLIST); \ + echo " ✓ launchd agent reloaded"; \ + else \ + echo " · launchd agent not installed (skipping)"; \ + fi + @if [ -f $(WATCHDOG_PLIST) ]; then \ + install -m 755 systemd/streamdeck-go-watchdog.sh $(BIN_DIR)/streamdeck-go-watchdog; \ + sed -e 's|STREAMDECK_WATCHDOG_PATH|$(BIN_DIR)/streamdeck-go-watchdog|' \ + -e 's|STREAMDECK_WATCHDOG_LOG_PATH|$(WATCHDOG_LOG)|g' \ + launchd/com.woodarddigital.streamdeck-go-watchdog.plist > $(WATCHDOG_PLIST); \ + launchctl bootout gui/$$(id -u)/com.woodarddigital.streamdeck-go-watchdog 2>/dev/null || true; \ + launchctl bootstrap gui/$$(id -u) $(WATCHDOG_PLIST); \ + echo " ✓ watchdog refreshed"; \ + else \ + echo " · watchdog not installed (skipping)"; \ + fi + @if [ -f $(CONFIG_DIR)/modules.yaml ]; then \ + install -m 644 modules.example.yaml $(CONFIG_DIR)/modules.yaml; \ + echo " ✓ modules.yaml updated"; \ + else \ + echo " · config dir not set up (skipping modules.yaml)"; \ + fi +else +reinstall: build + @echo " ━━━ streamdeck-go reinstall ━━━" + @if [ -f $(BIN_DIR)/$(BINARY) ]; then \ + install -m 755 $(BINARY) $(BIN_DIR)/$(BINARY); \ + echo " ✓ binary → $(BIN_DIR)/$(BINARY)"; \ + else \ + echo " · binary not installed (skipping — run 'make install' first)"; \ + fi + @if [ -f $(SYSTEMD_USER)/streamdeck-go.service ]; then \ + install -m 644 systemd/streamdeck-go.service $(SYSTEMD_USER)/streamdeck-go.service; \ + systemctl --user daemon-reload; \ + systemctl --user restart streamdeck-go.service; \ + echo " ✓ systemd unit refreshed and service restarted"; \ + else \ + echo " · systemd user service not installed (skipping)"; \ + fi + @if [ -f $(SYS_BIN)/$(HELPER) ]; then \ + $(MAKE) -s build-helper; \ + sudo install -m 750 $(HELPER) $(SYS_BIN)/$(HELPER); \ + sudo chown root:$(GROUP) $(SYS_BIN)/$(HELPER); \ + sudo install -m 644 systemd/streamdeck-go-helper.service $(SYSTEMD_SYS)/streamdeck-go-helper.service; \ + sudo systemctl daemon-reload; \ + sudo systemctl restart streamdeck-go-helper.service; \ + echo " ✓ helper refreshed and restarted"; \ + else \ + echo " · helper not installed (skipping)"; \ + fi + @if [ -f $(SYSTEMD_USER)/streamdeck-go-watchdog.timer ]; then \ + install -m 755 systemd/streamdeck-go-watchdog.sh $(BIN_DIR)/streamdeck-go-watchdog; \ + install -m 644 systemd/streamdeck-go-watchdog.service $(SYSTEMD_USER)/streamdeck-go-watchdog.service; \ + install -m 644 systemd/streamdeck-go-watchdog.timer $(SYSTEMD_USER)/streamdeck-go-watchdog.timer; \ + systemctl --user daemon-reload; \ + systemctl --user restart streamdeck-go-watchdog.timer; \ + echo " ✓ watchdog refreshed"; \ + else \ + echo " · watchdog not installed (skipping)"; \ + fi + @if [ -f $(CONFIG_DIR)/modules.yaml ]; then \ + install -m 644 modules.example.yaml $(CONFIG_DIR)/modules.yaml; \ + echo " ✓ modules.yaml updated"; \ + else \ + echo " · config dir not set up (skipping modules.yaml)"; \ + fi +endif + # ── Uninstall ───────────────────────────────────────────────────────────────── ifeq ($(OS),Darwin) diff --git a/README.md b/README.md index 2ce3919..3799e94 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,33 @@ first (respecting `$XDG_CONFIG_HOME`). The repo's `config.yaml` is gitignored. --- +### Updating — `make reinstall` + +After pulling new code or editing a Go source file, refresh whatever's already +deployed without going through the full installer: + +```bash +git pull +make reinstall +``` + +`reinstall` rebuilds the binary and refreshes only the pieces that are already +installed: + +| Component | Action when present | +|-------------------|--------------------------------------------------------------------| +| Main binary | rebuilt and copied into `~/.local/bin` (Linux) or `~/go/bin` (macOS) | +| Service unit | systemd unit / launchd plist re-installed; service restarted | +| Helper (Linux) | rebuilt, re-installed under `/usr/local/bin`, helper service restarted (sudo) | +| Watchdog | script + unit/plist refreshed and timer restarted | +| `modules.yaml` | re-copied from `modules.example.yaml` into the active config dir | + +Anything not currently installed prints `· skipped` instead of failing. +No dependency installs, no dotfile prompts, no symlink logic — that's still +`make install`'s job. + +--- + ### AUR (Arch Linux) > AUR package coming soon. Until then, use `make install` above. diff --git a/cmd/streamdeck/main.go b/cmd/streamdeck/main.go index 5bf8ca8..7e0c9d2 100644 --- a/cmd/streamdeck/main.go +++ b/cmd/streamdeck/main.go @@ -754,7 +754,7 @@ func loadImage(path string) (image.Image, error) { } func loadSVG(path string) (image.Image, error) { - icon, err := oksvg.ReadIcon(path, oksvg.WarnErrorMode) + icon, err := oksvg.ReadIcon(path, oksvg.IgnoreErrorMode) if err != nil { return nil, err }