a-p-s.service: depend on /etc/rc.conf existing
update comment path ref to generator
move lvm/dmraid services to systemd-arch-units
a-p-s: honor /etc/localtime as a symlink

avoid hardcoding paths, too
a-p-s: avoid relink when unneeded
update README
a-p-s: fix syntax error
refactor and replace a-p-s

Two changes:

 1) remove TIMEZONE handling. We should advice users to delete the TIMEZONE
    from their rc.conf, and then both initscripts and systemd will leave the
    TIMEZONE alone. To change / set the timezone, symlink /etc/localtime manually,
    or use the relevant GUI in your DE.

 2) move the parsing of MODULES from shutdown to boot. We now write this to /run,
    and we no longer need to write to /etc.

As we now move the service file from shutdown to boot, we need to disable and
(conditionally) enable it again. This requires a bit of a hack (as far as I can see).
The below snippet for the install file should do the trick:

  # the old serivce was enabled
  if [ -L /etc/systemd/system/shutdown.target.wants/arch-persistent-settings.service ]; then

    # disable non-existent service
    rm /etc/systemd/system/shutdown.target.wants/arch-persistent-settings.service

    # enable replacement service
    ln -s /lib/systemd/system/arch-modules-load.service /etc/systemd/system/sysinit.target.wants/

    # remove autogenerated file, this is now generated in /run instead
    # the file comes with a warning not to change it, so this should be safe
    rm -f /etc/modules-load.d/rc.conf

    # move autogenerated file, the blacklisting might still be relevant until next boot
    [ -e /etc/modprobe.d/rc.conf ] && mv /etc/modprobe.d/rc.conf /run/modprobe.d/

  fi

  # reload the config after upgade
  if [ -e /sys/fs/cgroup/systemd ]; then
    systemctl daemon-reload
  fi

Signed-off-by: Tom Gundersen <teg@jklm.no>
rc.local: split rc.local and rc.local.shutdown

They are not necessarily connected, so we should run rc.local.shutdown
irrespective of whether or not rc.local succeeded. Also, we should not ignore
their return values.

We need to conditionally enable the split out unit if rc-local.service was enabled.
Adding the following to the post-upgrade script should do the trick:

  if [ -L /etc/systemd/system/multi-user.target.wants/rc-local.service ]; then

    # rc-local.service was enabled, so we should enable rc-local-shutdown.service
    ln -s /lib/systemd/system/rc-local-shutdown.service /etc/systemd/system/shutdown.target.wants/

  fi

  # reload the config after upgade
  if [ -e /sys/fs/cgroup/systemd ]; then
    systemctl daemon-reload
  fi

Signed-off-by: Tom Gundersen <teg@jklm.no>
Updated README

Signed-off-by: Tom Gundersen <teg@jklm.no>
arch-daemons: fix dependencies when mixing native and legacy services

Note: "legacy service" refers to an auto-geneated service file, found in
/run/systemd/generator/arch-daemons.target.wants/, and based on the DAEMONS
array in rc.conf; and "native service" refers to a sevice file in
/{etc,lib}/systemd/system/.

Before: Each legacy sevice would be ordered After the previous non-background
legacy service. If no native units were used this meant it was ordered after
all previous non-background legacy services. However, if a native service file
exists this took precedense, and this did not necessarily preserve the order.

After: Each legacy service is ordere After each of the previous non-background
legacy services (from the DAEMONS array). This means that overriding a legacy
service with a native one no longer breaks the dependencies of subsequent
services.

[Dave: fix argument passing and add gratuitous quoting]

Signed-off-by: Tom Gundersen <teg@jklm.no>
Merge branch 'for-dave'

* for-dave:
  arch-daemons: fix dependencies when mixing native and legacy services
  Updated README
  rc.local: split rc.local and rc.local.shutdown
  refactor and replace a-p-s
install to /usr/lib/systemd
arch-modules-load: fix launching and directory creation
arch-daemons: clean up generator

- fix GH issue #22
- don't write empty After= or initial blank lines
README: remove lvm/mdadm references

These unit files are no longer part of this package.

Signed-off-by: Tom Gundersen <teg@jklm.no>
arch-daemons: generate legacy units for all rc scripts

This allows "systemctl start my_legacy_rc_script.service" to work
even if there is not (yet) a native systemd serivce file installed for this
daemon.

This unifies the rc.conf DAEMONS array with the "start" handling,
which up until now were done very differently.

The former was done by arch-daemons, but the latter were done by systemd's
internal sysvcompat layer. This layer can now be disabled from our package,
as it never worked very well in Arch.

The legacy units do not come with an [Install] section, so "systemctl enable"
will not work. The user has the choice between enabling them in DAEMONS
or (better) creating (and pushing upstream) proper units.

Signed-off-by: Tom Gundersen <teg@jklm.no>