mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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>
28 lines
770 B
Bash
Executable File
28 lines
770 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
case "$1" in
|
|
upgrade)
|
|
# Handle removing freedombox-setup-repositories.timer from 20.5.
|
|
if dpkg --compare-versions "$2" le 20.7; then
|
|
if [ -x "/usr/bin/deb-systemd-invoke" ]; then
|
|
deb-systemd-invoke stop freedombox-setup-repositories.timer >/dev/null 2>/dev/null || true
|
|
fi
|
|
|
|
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
|
deb-systemd-helper purge freedombox-setup-repositories.timer >/dev/null || true
|
|
deb-systemd-helper unmask freedombox-setup-repositories.timer >/dev/null || true
|
|
fi
|
|
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|