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
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)