Hi,

Ludovic Courtès <[email protected]> writes:

> Hi,
>
> Maxim Cournoyer <[email protected]> writes:
>
>> Fixes: bug#77806
>
> I would provide the complete URL, as is usually done, to avoid
> ambiguity.

Okay, done.

>> +         (actions (list (shepherd-configuration-action
>> +                         "/etc/elogind/logind.conf"))))))
>
> Would it be possible to give the config file name in the store instead?
> That way, we would know which one is actually in effect (when one
> reconfigures, /etc/logind/logind.conf is changed through activation but
> elogind keeps honoring the previous version of it, which is why
> distinguishing between both can be helpful IMO.)

I did what you had suggested earlier with a custom
'shepherd-configuration-action' job that accepts multiple files:

--8<---------------cut here---------------start------------->8---
1 file changed, 13 insertions(+), 2 deletions(-)
gnu/services/desktop.scm | 15 +++++++++++++--

modified   gnu/services/desktop.scm
@@ -1505,6 +1505,16 @@ (define (pam-extension-procedure config)
              (session (cons pam-elogind (pam-service-session pam))))))
          (shepherd-requirements '(elogind)))))
 
+(define* (shepherd-configuration-action* files)
+  "Return a 'configuration' action to display FILES, which should be the names
+of the service's configuration files."
+  (shepherd-action
+   (name 'configuration)
+   (documentation "Display the names of this service's configuration files.")
+   (procedure #~(lambda (_)
+                  (format #t "~{~a~%~}" '#$files)
+                  '#$files))))
+
 (define (elogind-shepherd-service config)
   "Return a Shepherd service to start elogind according to @var{config}."
   (list (shepherd-service
@@ -1514,8 +1524,9 @@ (define (elogind-shepherd-service config)
                    (list #$(file-append (elogind-configuration-elogind config)
                                         "/libexec/elogind/elogind"))))
          (stop #~(make-kill-destructor))
-         (actions (list (shepherd-configuration-action
-                         "/etc/elogind/logind.conf"))))))
+         (actions (list (shepherd-configuration-action*
+                         (list (logind.conf config)
+                               (sleep.conf config))))))))
 
 (define elogind-service-type
   (service-type
--8<---------------cut here---------------end--------------->8---

And it seems to work correctly on my machine:

--8<---------------cut here---------------start------------->8---
$ sudo herd configuration elogind
/gnu/store/z2hdrmyxjd0x7msf66638ppl9hx99fh3-logind.conf
/gnu/store/hqbmn9idlydkkm554k1zrhi306ffsldl-sleep.conf
maxim@terra ~$ cat /gnu/store/hqbmn9idlydkkm554k1zrhi306ffsldl-sleep.conf
[Sleep]
SuspendState=mem standby freeze
SuspendEstimationSec=3600
HibernateMode=platform shutdown
maxim@terra ~$ find /etc/elogind/
/etc/elogind/
/etc/elogind/logind.conf.d
/etc/elogind/logind.conf.d/logind.conf
/etc/elogind/sleep.conf.d
/etc/elogind/sleep.conf.d/sleep.conf
maxim@terra ~$ readlink /etc/elogind/logind.conf.d/logind.conf
/gnu/store/z2hdrmyxjd0x7msf66638ppl9hx99fh3-logind.conf
maxim@terra ~$ readlink /etc/elogind/sleep.conf.d/sleep.conf
/gnu/store/hqbmn9idlydkkm554k1zrhi306ffsldl-sleep.conf
--8<---------------cut here---------------end--------------->8---

Josselin pointed to some problem, which I've now fix (had to use
"drop-ins" files instead of the canonical config file names, which are
looked from the package's sysconfdir in the store instead of under
/etc/elogind).  If we find other we can fix them later, but it seems to
me it can't be much worst than it is now, so I've now pushed this to
master, with commit f10d00e4e25.

Thanks to everyone who helped figure that one out!

-- 
Thanks,
Maxim



Reply via email to