fix: handle masked/missing caddy.service during package transition #2
Reference in New Issue
Block a user
Delete Branch "fix/postinst-masked-unit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The deb postinst script fails when replacing stock caddy on hosts where
caddy.servicewas masked. The unit file/usr/lib/systemd/system/caddy.servicedoesn't survive the transition — it's listed in the deb manifest but not on disk after dpkg removes the old caddy package.systemctl enable caddy.servicethen fails.Changes
debian/postinstsystemctl unmask caddy.serviceremoves the/dev/nullsymlink if the unit was maskeddebian/caddy.servicesystemctl stop caddy-api.service 2>/dev/null || truedaemon-reloadto cover all edge casesdebian/preinst(new)caddy.serviceandcaddy-api.servicewith|| trueguards before install/upgradeMakefilepreinstin deb build alongside other maintainer scriptsScenarios Handled
Testing
make debCloses #1