[OpenAFS] post-init scripts with systemd

Ken Dreyer ktdreyer@ktdreyer.com
Fri, 9 Nov 2012 17:56:34 -0700


Fedora has switched to systemd for service management. A year ago,
Edward Yang contributed systemd unit files for OpenAFS.org under
/src/packaging/RedHat.

In the classic SysV-style init scripts, there was an undocumented
option $AFS_POST_INIT, and users could set this option to a script
that would run after afsd started. Users could use this script to set
custom sysnames, enable encryption, etc.

The OpenAFS.org systemd unit file does not support AFS_POST_INIT.
There is no easy way to use the current OpenAFS.org systemd unit files
and have the sort of post-configuration flexibility that the SysV init
scripts provided.


RPM Fusion's OpenAFS packages originally shipped SysV init scripts
that were written from scratch. For Fedora 18, we're (finally)
switching to systemd for the RPM Fusion OpenAFS packages. We're taking
this opportunity to try very hard to use upstream's systemd unit files
themselves, and to only ship individual patches against them. This
should keep us closer to upstream.

Jack and I have come up with a solution to support post-init scripts
in systemd. We ship a single file, /usr/libexec/openafs/posthooks.sh,
which runs in openafs-client.service like this:

ExecStartPost=/usr/libexec/openafs/posthooks.sh

This shell script sources any shell scripts in
/etc/openafs/posthooks.d . This allows us to ship small shell scripts
that enable encryption, set the sysname, etc. It also provides an area
for users to drop in any additional posthooks that they want to use.
Also, users could just zero out the files if they want to disable them
(similar to /etc/httpd/conf.d).

I think this is useful and could go upstream into the openafs.org
packages. Any comments or suggestions on this idea?

- Ken