Sunil Mohan Adapa af5e0e1b24
debian: Remove timer to setup repositories properly
When removing systemd services, dh_installsystemd has no idea about services
present in the older versions that been removed. So, it generates no handling
scripts for those services. No convenience methods exist too.

dh_installsystemd uses deb-systemd-helper which maintains state files in
/var/lib/systemd/deb-systemd-helper-enabled/*.dsh-also. These files need to
removed apart from symlinks created in /etc/systemd/system enable services are
enabled. If the service/timer is currently running, stop it too.

Use deb-systemd-helper and deb-systemd-invoke to achieve this.

Closes: #1835

Tests performed:

- Install a freedombox version older than 20.5. Upgrade to 20.5. Notice the
incorrect symlink
/etc/systemd/system/multi-user.target.wants/freedombox-setup-repositories.timer
and also the state file
/var/lib/systemd/deb-systemd-helper-enabled/freedombox-setup-repositories.timer.dsh-also
Then upgrade to a .deb packages built with the patch. The two files will be
removed. No extra messages are warnings are printed during package upgrade.

- Install a freedombox version older than 20.5. Upgrade to .deb packages built
with this patch. Notice the same results.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-04-24 15:45:01 -04:00
..
2020-04-20 18:39:06 -04:00