diff -Nru anacron-2.3/debian/anacron.postinst anacron-2.3/debian/anacron.postinst --- anacron-2.3/debian/anacron.postinst 1970-01-01 01:00:00.000000000 +0100 +++ anacron-2.3/debian/anacron.postinst 2023-02-08 09:53:26.000000000 +0100 @@ -0,0 +1,46 @@ +#!/bin/sh + +set -e + +# Workaround an issue when upgrading from anacron 2.3-33ubuntu1 (LP: #2006589) +# (this comment is copy-pasted across preinst and postinst scripts) +# +# anacron 2.3-33ubuntu1 has a bug where its postrm script unconditionaly +# removes the systemd service and timer files, thus disabling them; this issue +# only gets triggered upon package removal or upgrade since upgrades call the +# postrm script of the previous package version +# +# We work around this bug by backing up the corresponding files during our +# preinst and restoring them in our postinst. + +SERVICE_TIMER_STATUS_DIR="/var/lib/dpkg/anacron-service-timer-status" + +restore_service_timer() { + local origin + local backup + local name + + origin="$1" + backup="${SERVICE_TIMER_STATUS_DIR}/$2" + + name="$(basename "${origin}")" + + if [ -e "${backup}" ]; then + if ! [ -e "${origin}" ]; then + mv "${backup}" "${origin}" + echo "Warning: ${name} was probably disabled moments ago during the upgrade from anacron 2.3-33ubuntu1; re-enabling now (pointing to \`$(readlink "${origin}")'" + else + echo "Warning: found a backup for ${name} but a file exists at the original location; please check its status and configuration; backup is available at \`${backup}'" + fi + else + echo "Warning: no backup for ${name} at \`${backup}'; check its configuration" + fi +} + +if [ "$1" = "configure" ] && [ "$2" = "2.3-33ubuntu1" ]; then + restore_service_timer '/etc/systemd/system/multi-user.target.wants/anacron.service' "anacron-service-backup" + restore_service_timer '/etc/systemd/system/timers.target.wants/anacron.timer' "anacron-timer-backup" + rmdir --ignore-fail-on-non-empty "${SERVICE_TIMER_STATUS_DIR}" +fi + +#DEBHELPER# diff -Nru anacron-2.3/debian/anacron.postrm anacron-2.3/debian/anacron.postrm --- anacron-2.3/debian/anacron.postrm 2022-07-13 23:45:00.000000000 +0200 +++ anacron-2.3/debian/anacron.postrm 2023-02-08 09:53:26.000000000 +0100 @@ -8,13 +8,4 @@ rm -rf /var/spool/anacron fi -# Close bug #993348, remove dangling symlinks if they exist -if [ -f /etc/systemd/system/multi-user.target.wants/anacron.service ]; then - rm /etc/systemd/system/multi-user.target.wants/anacron.service -fi - -if [ -f /etc/systemd/system/timers.target.wants/anacron.timer ]; then - rm /etc/systemd/system/timers.target.wants/anacron.timer -fi - #DEBHELPER# diff -Nru anacron-2.3/debian/anacron.preinst anacron-2.3/debian/anacron.preinst --- anacron-2.3/debian/anacron.preinst 2022-07-13 23:44:59.000000000 +0200 +++ anacron-2.3/debian/anacron.preinst 2023-02-08 09:53:26.000000000 +0100 @@ -2,6 +2,40 @@ set -e +# Workaround an issue when upgrading from anacron 2.3-33ubuntu1 (LP: #2006589) +# (this comment is copy-pasted across preinst and postinst scripts) +# +# anacron 2.3-33ubuntu1 has a bug where its postrm script unconditionaly +# removes the systemd service and timer files, thus disabling them; this issue +# only gets triggered upon package removal or upgrade since upgrades call the +# postrm script of the previous package version +# +# We work around this bug by backing up the corresponding files during our +# preinst and restoring them in our postinst. + +backup_service_timer() +{ + local kind + local symlink + + local SERVICE_TIMER_STATUS_DIR="/var/lib/dpkg/anacron-service-timer-status" + + kind="$1" + symlink="$2" + + mkdir -p "${SERVICE_TIMER_STATUS_DIR}" + + if [ -e "${symlink}" ] || systemctl show --property=UnitFileState "anacron.${kind}" | grep -q '=enabled$'; then + echo "Warning: anacron.${kind} will be disabled during the upgrade from anacron 2.3-33ubuntu1; we'll do our best to re-enable it (currently points to \`$(readlink "${symlink}")')" + cp -a "${symlink}" "${SERVICE_TIMER_STATUS_DIR}/anacron-${kind}-backup" + fi +} + +if [ "$1" = "upgrade" ] && [ "$2" = "2.3-33ubuntu1" ]; then + backup_service_timer 'service' '/etc/systemd/system/multi-user.target.wants/anacron.service' + backup_service_timer 'timer' '/etc/systemd/system/timers.target.wants/anacron.timer' +fi + if dpkg --compare-versions "$2" lt-nl 2.3-24; then deb-systemd-helper purge anacron-resume.service >/dev/null deb-systemd-helper unmask anacron-resume.service >/dev/null diff -Nru anacron-2.3/debian/changelog anacron-2.3/debian/changelog --- anacron-2.3/debian/changelog 2022-08-16 17:20:52.000000000 +0200 +++ anacron-2.3/debian/changelog 2023-02-08 09:53:26.000000000 +0100 @@ -1,3 +1,15 @@ +anacron (2.3-33ubuntu2) kinetic; urgency=low + + [ Adrien Nader ] + * Work around upgrades from 2.3-33ubuntu1 disabling service and timer + (LP: #2006589) + + [ Lance Lin ] + * d/anacron.postrm: delete removal of symlinks (Closes: #1019554) + * Add d/NEWS (Closes: #1028205) + + -- Adrien Nader Wed, 08 Feb 2023 09:53:26 +0100 + anacron (2.3-33ubuntu1) kinetic; urgency=low * Merge from Debian unstable. Remaining changes: diff -Nru anacron-2.3/debian/control anacron-2.3/debian/control --- anacron-2.3/debian/control 2022-08-16 17:20:52.000000000 +0200 +++ anacron-2.3/debian/control 2023-02-08 09:53:26.000000000 +0100 @@ -4,7 +4,7 @@ Build-Depends: debhelper-compat (= 13) Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Lance Lin +XSBC-Original-Maintainer: Lance Lin Standards-Version: 4.6.1 Rules-Requires-Root: no Homepage: http://sourceforge.net/projects/anacron/ diff -Nru anacron-2.3/debian/NEWS anacron-2.3/debian/NEWS --- anacron-2.3/debian/NEWS 1970-01-01 01:00:00.000000000 +0100 +++ anacron-2.3/debian/NEWS 2023-02-08 09:53:26.000000000 +0100 @@ -0,0 +1,21 @@ +anacron (2.3-33ubuntu2) kinetic; urgency=low + + If you have installed Ubuntu Kinetic Kudu and then upgraded to Lunar + Lobster during its development cycle before mid March 2023, then anacron + might no longer be enabled and the daily/weekly/monthly cron jobs might + not be run until it is. + + Since not all cron jobs have migrated to systemd timers, Ubuntu Lunar + Lobster systems with anacron may be missing some essential cron jobs. + + To see if a system is affected you can use these commands: + + zgrep -i anacron.*2.3-33 /var/log/apt/history.log* + systemctl status anacron.service anacron.timer + + To re-enable anacron you can use these commands: + + sudo systemctl enable anacron.service anacron.timer + sudo systemctl start anacron.service anacron.timer + + -- Adrien Nader Tue, 21 Mar 2023 21:42:12 +0100