Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503714 - sci-mathematics/gimps improved systemd unit file
Summary: sci-mathematics/gimps improved systemd unit file
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Thomas Kahle (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-07 11:49 UTC by Paolo Pedroni
Modified: 2014-03-07 21:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Improved systemd unit file for gimps (gimps.service,487 bytes, text/plain)
2014-03-07 11:50 UTC, Paolo Pedroni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Pedroni 2014-03-07 11:49:13 UTC
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
Comment 1 Paolo Pedroni 2014-03-07 11:50:06 UTC
Created attachment 371946 [details]
Improved systemd unit file for gimps
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2014-03-07 14:59:48 UTC
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
Comment 3 Thomas Kahle (RETIRED) gentoo-dev 2014-03-07 19:33:50 UTC
Included in 28.5.  Thanks!
Comment 4 Pacho Ramos gentoo-dev 2014-03-07 21:12:42 UTC
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)
Comment 5 Thomas Kahle (RETIRED) gentoo-dev 2014-03-07 21:18:30 UTC
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.
Comment 6 Pacho Ramos gentoo-dev 2014-03-07 21:36:42 UTC
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
Comment 7 Thomas Kahle (RETIRED) gentoo-dev 2014-03-07 21:40:57 UTC
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