fix: handle masked/missing caddy.service during package transition
Fixes the postinst failure when replacing stock caddy on hosts where caddy.service was masked. The unit file could be missing after dpkg removes the old caddy package, causing systemctl enable to fail. Changes: - postinst: unmask caddy.service before enable, recreate unit file from embedded copy if missing after unmasking, stop caddy-api.service with guard - preinst (new): stop caddy.service and caddy-api.service with || true guards before install/upgrade - Makefile: include preinst in deb build Handles three scenarios: 1. Fresh install (no prior caddy) 2. Upgrade from stock caddy with masked service 3. Upgrade from previous madcat-caddy Closes #1
This commit is contained in:
@@ -49,10 +49,11 @@ deb: $(BUILD_DIR)/caddy
|
||||
sed 's/{{VERSION}}/$(VERSION)-$(REVISION)/g; s/{{ARCH}}/$(ARCH)/g' debian/control > $(STAGING_DIR)/DEBIAN/control
|
||||
|
||||
@# Scripts
|
||||
cp debian/preinst $(STAGING_DIR)/DEBIAN/
|
||||
cp debian/postinst $(STAGING_DIR)/DEBIAN/
|
||||
cp debian/prerm $(STAGING_DIR)/DEBIAN/
|
||||
cp debian/postrm $(STAGING_DIR)/DEBIAN/
|
||||
chmod 755 $(STAGING_DIR)/DEBIAN/postinst $(STAGING_DIR)/DEBIAN/prerm $(STAGING_DIR)/DEBIAN/postrm
|
||||
chmod 755 $(STAGING_DIR)/DEBIAN/preinst $(STAGING_DIR)/DEBIAN/postinst $(STAGING_DIR)/DEBIAN/prerm $(STAGING_DIR)/DEBIAN/postrm
|
||||
|
||||
@# Conffiles
|
||||
cp debian/conffiles $(STAGING_DIR)/DEBIAN/
|
||||
|
||||
Reference in New Issue
Block a user