# About starting dbab on machine starts

This has not been an issue until things get complicated. OK, here was my goal:

- Start the dbab service on on machine starts.
- Make it possible by using the SysV init.d script.
- But also support those systems that uses Systemd.
- And most importantly, support as many systems in different version as
  possible.

## V1.2.2 solution

Every effort has been made to make sure no compromise in Debian Sid because
a package uploaded to unstable is packaged for unstable and should work as
well as possible there. For others, a separated build if required, and
even separated patches if necessary. I.e., pack each distro separately.


## V1.2.1 solution

The goal sounds good, but only on paper, because there have to be some serious
compromises to make. Here is a list of all issues that need to dealt with:

- This original init script that I provided myself
  lacks error handling, and is fragile and racy, too.

- There is a ready-made solution, `/lib/init/init-d-script` from
  `sysvinit-utils` (ver 2.88dsf-58), that provides out-of-box solution.

- However, that solution is not available in Ubuntu, even in latest 14.10.

- If I borrow that ready-made code into my own package, Sid will be upset
  if I still call it `/lib/init/init-d-script`.

- However if I do not call it `/lib/init/init-d-script`, then the
  package can't even be built. lintian will complain loudly:

  ~~~
  E: dbab: init.d-script-does-not-implement-required-option etc/init.d/dbab start
  E: dbab: init.d-script-does-not-implement-required-option etc/init.d/dbab stop
  E: dbab: init.d-script-does-not-implement-required-option etc/init.d/dbab restart
  E: dbab: init.d-script-does-not-implement-required-option etc/init.d/dbab force-reload
  W: dbab: init.d-script-does-not-source-init-functions etc/init.d/dbab
  ~~~

- So the only option that I have is to have a renamed private
  /lib/init/init-d-script file, then override the above lintian errors.
  Otherwise, I can't make all the following three happy: Debian Sid,
  Debian wheezy and Ubuntu.

- That's the compromises regarding SysV init.d script. The Systemd is
  not much different.

- In order to have Systemd support, the `debian/rules` has to use

      dh $@ --with systemd

- However, that will introduce a installation dependency `init-system-helpers`,
  and it's version has to `>= 1.18~`.

- But if you take a look at Debian & Ubuntu, neither Debian Wheezy nor
  Ubuntu Trusty (14.04LTS) support that (at least by default).

- So I *have to* drop that v1.18 `init-system-helpers` dependency,
  meaning that I have to build without the `--with systemd`.

- I believe that the impact on the systemd systems is that the dbab service
  will not starts on machine starts, unless you, the systemd user, manually
  symlink the `/lib/systemd/system/dbab.service` file into
  `/etc/systemd/system/`.

OK, hopefully for now, most if not all people are happy.
