From 552c30eae49079817b918273050c56126564c872 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Mon, 25 Oct 2021 14:16:26 +0200
Subject: [PATCH] systemd: add "RuntimeDirectory" directive

---
 NEWS                          | 1 +
 systemd/system/mpd.service.in | 4 ++++
 systemd/user/mpd.service.in   | 4 ++++
 3 files changed, 9 insertions(+)

diff --git a/NEWS b/NEWS
index b63e85ccf..ec66b608c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.23.3 (not yet released)
 * output
   - alsa: add option "stop_dsd_silence" to work around DSD DAC noise
 * macOS: fix libfmt related build failure
+* systemd: add "RuntimeDirectory" directive
 
 ver 0.23.2 (2021/10/22)
 * protocol
diff --git a/systemd/system/mpd.service.in b/systemd/system/mpd.service.in
index 4f4c9fff0..c54954246 100644
--- a/systemd/system/mpd.service.in
+++ b/systemd/system/mpd.service.in
@@ -7,6 +7,10 @@ After=network.target sound.target
 Type=notify
 ExecStart=@prefix@/bin/mpd --no-daemon
 
+# Create /run/mpd (if MPD is launched without the socket unit and is
+# configured to bind listener sockets there).
+RuntimeDirectory=mpd
+
 # Enable this setting to ask systemd to watch over MPD, see
 # systemd.service(5).  This is disabled by default because it causes
 # periodic wakeups which are unnecessary if MPD is not playing.
diff --git a/systemd/user/mpd.service.in b/systemd/user/mpd.service.in
index 422f60a92..8b5a39fd4 100644
--- a/systemd/user/mpd.service.in
+++ b/systemd/user/mpd.service.in
@@ -7,6 +7,10 @@ After=network.target sound.target
 Type=notify
 ExecStart=@prefix@/bin/mpd --no-daemon
 
+# Create /run/user/$UID/mpd (if MPD is launched without the socket
+# unit and is configured to bind listener sockets there).
+RuntimeDirectory=mpd
+
 # Enable this setting to ask systemd to watch over MPD, see
 # systemd.service(5).  This is disabled by default because it causes
 # periodic wakeups which are unnecessary if MPD is not playing.
-- 
2.24.1