I managed to come up with a better systemd unit file for sci-mathematics/gimps, that restores most of the functionality of the OpenRC init file, such as running as a user different than root (hardwired to 'nobody', because apparently you cannot assign an environment variable to User and Group keywords in a systemd file) and refusing to start if no local configuration is present. The new systemd unit file is attached to this bug report. Thanks for the patience. Reproducible: Always
Created attachment 371946 [details] Improved systemd unit file for gimps
Comment on attachment 371946 [details] Improved systemd unit file for gimps --- files/gimps.service 2014-02-15 13:22:34.000000000 +0100 +++ - 2014-03-07 15:59:35.645603343 +0100 @@ -4,9 +4,14 @@ Wants=local-fs.target [Service] +EnvironmentFile=/etc/conf.d/gimps User=nobody Group=nobody -ExecStart=/opt/gimps/mprime -w/var/lib/gimps +PermissionsStartOnly=true +ConditionPathIsDirectory=${GIMPS_DIR} +ExecStartPre=-/bin/sh -c "chown %u ${GIMPS_DIR}" +ConditionPathExist=${GIMPS_DIR}/local.txt +ExecStart=/opt/gimps/mprime -w${GIMPS_DIR} ${GIMPS_OPTIONS} StandardOutput=null StandardError=journal
Included in 28.5. Thanks!
I am unsure it's really an improvement: https://wiki.gentoo.org/wiki/Systemd/Ebuild_policy#Unit_file_guidelines Explains why relying on conf.d files is not a good idea. In this case, the unit file I provided was using the default directory and the tmpfiles.d file was ensuring it was created with proper permissions already. Now, people can play with that directory and we need to die when it's not present and fix permissions from unit file :/ Regarding GIMPS_OPTIONS, current conf.d file simply sets none, then, I don't think there is such need of letting people to pass random options from there (they can change ExecStart if they want to play with all the available options)
Pacho, I'm sorry. I had not seen this wiki page before, and I have not run systemd on any of my systems yet. If you care to do it, please commit a better version, revert to the old version, or suggest a resolution that I can implement. This is an uncommon package and my commit is very recent. If we fix things now, then chances are that no users see this ever.
I would revert to previous as I have explained for this concrete case (I have no problem on adding ways to configure things in some packages, but for this concrete case I committed the "non configurable one" on purpose to ensure we provide a unit file that will use a directory managed by systemd via tmpfiles.d
Done. Thanks. + 07 Mar 2014; Thomas Kahle <tomka@gentoo.org> -files/gimps.service-r1, + gimps-28.5.ebuild: + Revert back to original systemd unit file after consulting systemd team