[systemd-devel] Installing user unit files.

RĂ¼diger Sonderfeld ruediger at c-plusplus.de
Mon Dec 8 10:31:07 PST 2014


I'm currently in the process of adding a service file to GNU Emacs: 

The major point of discussion is how and where to install that file.  Systemd 
has guidelines for system service files in daemon(7).  One could follow them 
for user service files by simply replacing `systemdsystemunitdir' with 
`systemduserunitdir'.  Which is basically what the patch does so far.  However 
this would cause problems when (a) installing several versions of GNU Emacs in 
parallel and (b) user installations.

(a) could be solved by applying `program_transform_name' (from autoconf's 
AC_ARG_PROGRAM) to the service file name.  E.g., turning emacs.service into 

I'm not sure how to solve (b).  For a system service it might not make sense 
to install it somewhere outside of /usr (or /usr/local) and simply following 
`systemdsystemunitdir' makes sense.  But for a user application like GNU Emacs 
it should be possible to install it to any $prefix (e.g., ~/usr) without 
requiring root access.  Right now, I'm thinking of either setting the default 
to not install the service file or installing it to `datadir'.

What is the best practice for user unit files?  How are other projects 
handling this?


More information about the systemd-devel mailing list