reduce code duplication, and reload-or-restart timers just like service units instead of just starting them.
Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> --- debian/postinst | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/debian/postinst b/debian/postinst index 685f3c28..ebce2536 100755 --- a/debian/postinst +++ b/debian/postinst @@ -54,43 +54,28 @@ case "$1" in # same as dh_systemd_enable (code copied) - for timer in pvesr pve-daily-update; do - deb-systemd-helper unmask $timer.timer >/dev/null || true + UNITS="pvedaemon.service pveproxy.service spiceproxy.service pvestatd.service pvebanner.service pvesr.timer pve-daily-update.timer" + NO_RESTART_UNITS="pvenetcommit.service pve-guests.service" - # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --quiet was-enabled $timer.timer; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable $timer.timer >/dev/null || true - else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state $timer.timer >/dev/null || true - fi - done - - for service in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-guests; do - deb-systemd-helper unmask $service.service >/dev/null || true + for unit in ${UNITS} ${NO_RESTART_UNITS}; do + deb-systemd-helper unmask "$unit" >/dev/null || true # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --quiet was-enabled $service.service; then + if deb-systemd-helper --quiet was-enabled "$unit"; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable $service.service >/dev/null || true + deb-systemd-helper enable "$unit" >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state $service.service >/dev/null || true + deb-systemd-helper update-state "$unit" >/dev/null || true fi done if test ! -e /proxmox_install_mode; then - - for service in pvedaemon pveproxy spiceproxy pvestatd; do - deb-systemd-invoke reload-or-restart $service + for unit in ${UNITS}; do + deb-systemd-invoke reload-or-restart "$unit" done - - deb-systemd-invoke start pvesr.timer pve-daily-update.timer >/dev/null || true fi if test -z "$2"; then -- 2.14.2 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel