mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
services: elogind-configuration-file: Do not serialize unspecified items.
This a followup to 59ee837d8b
, which changed the
default value of the HandleLidSwitchExternalPower to the empty string.
Unfortunately this causes elogind to print a warning (although it otherwise
works as intended). This change fixes that.
* gnu/services/desktop.scm (elogind-configuration-file)<handle-action>: Let
the unspecified value go through.
<ini-file-clause>: When an unspecified file is encountered, do not produce any
text to serialize.
This commit is contained in:
parent
3ba8c2b507
commit
106660e3ff
1 changed files with 11 additions and 3 deletions
|
@ -1034,7 +1034,7 @@ (define handle-actions
|
|||
'(ignore poweroff reboot halt kexec suspend hibernate hybrid-sleep lock))
|
||||
(define (handle-action x)
|
||||
(if (unspecified? x)
|
||||
"" ;empty serializer
|
||||
x ;let the unspecified value go through
|
||||
(enum x handle-actions)))
|
||||
(define (sleep-list tokens)
|
||||
(unless (valid-list? tokens char-set:user-name)
|
||||
|
@ -1042,10 +1042,18 @@ (define (sleep-list tokens)
|
|||
(string-join tokens " "))
|
||||
(define-syntax ini-file-clause
|
||||
(syntax-rules ()
|
||||
;; Produce an empty line when encountering an unspecified value. This
|
||||
;; is better than an empty string value, which can, in some cases, cause
|
||||
;; warnings such as "Failed to parse handle action setting".
|
||||
((_ config (prop (parser getter)))
|
||||
(string-append prop "=" (parser (getter config)) "\n"))
|
||||
(let ((value (parser (getter config))))
|
||||
(if (unspecified? value)
|
||||
""
|
||||
(string-append prop "=" value "\n"))))
|
||||
((_ config str)
|
||||
(string-append str "\n"))))
|
||||
(if (unspecified? str)
|
||||
""
|
||||
(string-append str "\n")))))
|
||||
(define-syntax-rule (ini-file config file clause ...)
|
||||
(plain-file file (string-append (ini-file-clause config clause) ...)))
|
||||
(ini-file
|
||||
|
|
Loading…
Reference in a new issue