services: mpd: Fix daemon startup.

Until now it would wait for a PID file that'd never come.

* gnu/services/audio.scm (mpd-shepherd-service): Add 'requirement'.
Remove #:pid-file from 'start'.
(mpd-service-activation): Create the ".mpd" directory since that's what
the daemon expects.
This commit is contained in:
Ludovic Courtès 2020-11-06 23:10:18 +01:00
parent 7209d7cbc3
commit bb124f6e9c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -138,12 +138,12 @@ (define (mpd-file-name config file)
(define (mpd-shepherd-service config)
(shepherd-service
(documentation "Run the MPD (Music Player Daemon)")
(requirement '(user-processes))
(provision '(mpd))
(start #~(make-forkexec-constructor
(list #$(file-append mpd "/bin/mpd")
"--no-daemon"
#$(mpd-config->file config))
#:pid-file #$(mpd-file-name config "pid")
#:environment-variables
;; Required to detect PulseAudio when run under a user account.
(list (string-append
@ -161,7 +161,7 @@ (define (mpd-service-activation config)
(define %user
(getpw #$(mpd-configuration-user config)))
(let ((directory #$(mpd-file-name config "")))
(let ((directory #$(mpd-file-name config ".mpd")))
(mkdir-p directory)
(chown directory (passwd:uid %user) (passwd:gid %user))))))