%PDF- %PDF-
| Direktori : /var/lib/dpkg/info/ |
| Current File : //var/lib/dpkg/info/anacron.preinst |
#!/bin/sh
set -e
# Workaround an issue when upgrading from anacron 2.3-33 (LP: #2006589)
# (this comment is copy-pasted across preinst and postinst scripts)
#
# anacron 2.3-33 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-33; 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
fi
# Automatically added by dh_installinit/13.14.1ubuntu5
if [ "$1" = "install" ] && [ -n "$2" ] && [ -e "/etc/init.d/anacron" ] ; then
chmod +x "/etc/init.d/anacron" >/dev/null || true
fi
# End automatically added section