Adding make reinstall

This commit is contained in:
2026-04-26 14:00:43 -06:00
parent 212e957f49
commit 8b6b4d582d
3 changed files with 117 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ else
UDEV_RULE := /etc/udev/rules.d/99-streamdeck.rules UDEV_RULE := /etc/udev/rules.d/99-streamdeck.rules
endif 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 ───────────────────────────────────────────────────────────────────── # ── Build ─────────────────────────────────────────────────────────────────────
@@ -135,6 +135,94 @@ else
fi fi
endif 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 ───────────────────────────────────────────────────────────────── # ── Uninstall ─────────────────────────────────────────────────────────────────
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)

View File

@@ -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 (Arch Linux)
> AUR package coming soon. Until then, use `make install` above. > AUR package coming soon. Until then, use `make install` above.

View File

@@ -754,7 +754,7 @@ func loadImage(path string) (image.Image, error) {
} }
func loadSVG(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 { if err != nil {
return nil, err return nil, err
} }