Skip to content
  • Michael Biebl's avatar
    Use a file trigger to automatically enable service and socket units · d7e57817
    Michael Biebl authored
    A lot of packages simply install systemd units but do not enable them.
    Running "systemctl enable" in the maintainer scripts is not really an
    option since it is not guaranteed that systemd is installed. We
    therefore implement a workaround for wheezy which is supposed to go away
    in jessie once we have the necessary tools support in debhelper etc.
    
    What the proposed workaround does is:
    - Install a dpkg file trigger for /lib/systemd/system which triggers a
      script named /lib/systemd/debian-enable-units every time a package
      installs a systemd unit.
    - Run this script also upon initial installation of systemd and once on
      upgrades from earlier releases.
    
    The script in particular does the following:
    - Run "systemctl enable" for each service or socket it finds in
      /lib/systemd/system but does that only once, so the administrator can
      disable them if wanted.
    - Record the state and installed symlinks. When a package shipping
      systemd units is uninstalled, we remove those symlinks again.
    - Use a blacklist for internal services.
    - If systemd is not the active init, it will only create a tag file
      and next time we boot with systemd, the script will be run early
      during boot. For that we install a service named
      debian-enable-units.service which is run in basic.target.
    
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692150
    d7e57817