On the topic of where the units/symlinks are persisted, I don't really understand quite what you are trying to say (possibly my problem).
I guess the situations where there is an unexpected delay between new-preinst and new-postinst are when the system crashes or a maintainer script in a different package fails (I think?). The risk here is that an explicit systemctl disable anacron.service before "apt install -f" or whatever gets run will be ignored. I think given the general edge-case-y-ness of all this I'm OK with this?
The issue of persisting to /run or /var/lib is that the behaviour depends on if the system is rebooted between preinst and postinst. This frankly seems a bit surprising -- so I'd prefer you to change to persisting in /var/lib.
I think your change looks good.
On the topic of where the units/symlinks are persisted, I don't really understand quite what you are trying to say (possibly my problem).
I guess the situations where there is an unexpected delay between new-preinst and new-postinst are when the system crashes or a maintainer script in a different package fails (I think?). The risk here is that an explicit systemctl disable anacron.service before "apt install -f" or whatever gets run will be ignored. I think given the general edge-case-y-ness of all this I'm OK with this?
The issue of persisting to /run or /var/lib is that the behaviour depends on if the system is rebooted between preinst and postinst. This frankly seems a bit surprising -- so I'd prefer you to change to persisting in /var/lib.