Summary
Multiple HaLOS repositories now use the same deb-systemd-helper pattern for service enablement in their debian/postinst scripts. This pattern should be extracted into a shared template or script to reduce duplication and ensure consistency.
Current State
The following repositories have nearly identical postinst service enablement code:
The common pattern:
# Enable the systemd service
# Using deb-systemd-helper which works in chroots during image build
if command -v deb-systemd-helper >/dev/null 2>&1; then
deb-systemd-helper unmask 'SERVICE_NAME.service' >/dev/null || true
deb-systemd-helper enable 'SERVICE_NAME.service' >/dev/null || true
fi
# Start the service if systemd is running
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
systemctl start SERVICE_NAME.service >/dev/null || true
fi
Proposed Solution
Options to consider:
- Shared script in container-packaging-tools: A helper script that can be sourced or called from postinst
- Template generation: Generate postinst from a template during build
- Documentation: At minimum, document this pattern in the workspace so new repos follow it
Benefits
- Single source of truth for the pattern
- Easier to update if the approach needs to change
- Reduces copy-paste errors when creating new packages
Related
🤖 Generated with Claude Code
Summary
Multiple HaLOS repositories now use the same
deb-systemd-helperpattern for service enablement in theirdebian/postinstscripts. This pattern should be extracted into a shared template or script to reduce duplication and ensure consistency.Current State
The following repositories have nearly identical postinst service enablement code:
homarr-container-adapter(PR Container lifecycle conventions: Docker-managed restarts and journald logging #49)halos-mdns-publisher(PR docs: Add workspace documentation and update status files #20)The common pattern:
Proposed Solution
Options to consider:
Benefits
Related
🤖 Generated with Claude Code