Hi,
I use debhelper to install and enable systemd user units. I noticed that
after changing the `WantedBy` value from default.target to
graphical.target the new symlink was not created.
I attach a GraphViz .dot graph which visualizes a troubling number of
states caused by `dpkg -i`. Even more troubling are the facts that:
- reinstallation of the same version changes the state,
- purging the package (`dpkg -P`) can leave dead symlinks.
What do you think about that?
About the graph:
- version 4.0 has `WantedBy=default.target`,
- version 4.3 has `WantedBy=graphical.target`,
- `link` is the state of symlinks in /etc/systemd/user/*.target.wants,
- `dsh` is the state of the .dsh-also file.
At the same time systemctl:
- `enable` would add the second link leaving the first one,
- `disable` would remove both symlinks even if one of them is no longer
referenced by the unit file,
- `reenable` would leave only the symlink pointing to the currently
selected target.
I have some additional questions:
Why is `no_link_installed(…)` taken into account when setting
$create_links in `enable(…)`[1]?
[1]: https://salsa.debian.org/debian/init-system-helpers/-/blob/master/script/deb-systemd-helper
Is there a reason not to just use `reenable` in postinst scripts?
An old discussion in #717603 suggests[2] that it was intended to take
changes in the [Install] section into account.
[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717603