Comment 2 for bug 2006589

Revision history for this message
Adrien Nader (adrien) wrote :

I'm attaching a patch from 2.3.26ubuntu1 (kinetic's) to 2.3-36ubuntu2(~ppa2) which uses a heuristic to re-enable the service and/or the timer if they were previously enabled. There are comments inside the postinst/preinst scripts.

A typical test I used on my machine looked like the following:

  sudo dpkg -i ../lp/anacron_2.3-33ubuntu1_amd64.deb
  sudo systemctl enable anacron.timer
  sudo systemctl disable anacron.service
  sudo dpkg -i ../anacron_2.3-36ubuntu2\~ppa2_amd64.deb

The following displays the enabled/disabled status:

  systemctl show --property=UnitFileState anacron.timer
  systemctl show --property=UnitFileState anacron.service

As I mention in my changes, systemctl show/status have side-effects and I have no idea why.