From: Andreas Ziegler <br025@umbiko.net>
To: buildroot@buildroot.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Marcus Hoffmann <buildroot@bubu1.eu>,
Andreas Ziegler <br025@umbiko.net>
Subject: [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications
Date: Thu, 27 Aug 2026 05:26:38 +0200 [thread overview]
Message-ID: <20260827032643.1940-2-br025@umbiko.net> (raw)
In-Reply-To: <20260827032643.1940-1-br025@umbiko.net>
The configuration file supplied by Buildroot is only a sample; it will
not start MPD on a default installation. In a production build, a custom
mpd.conf has to be supplied via rootfs overlay.
Treat Buildroot mpd.conf as a fragment file, containing the minimum
modifications necessary to run mpd in a default build. Install the
upstream sample and inject the values from the Buildroot fragment.
* log_file, pid_file: Buildroot specific; referenced in mpd.mk and S95mpd
* audio_output: At least one output has to be defined to run mpd
Signed-off-by: Andreas Ziegler <br025@umbiko.net>
---
Changes v2 -> v3:
reintroduce Buildroot mpd.conf as fragment file
package/mpd/mpd.conf | 31 ++++++++-----------------------
package/mpd/mpd.mk | 22 +++++++++++++++++++++-
2 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/package/mpd/mpd.conf b/package/mpd/mpd.conf
index 5956b75e24..db81d69d73 100644
--- a/package/mpd/mpd.conf
+++ b/package/mpd/mpd.conf
@@ -1,32 +1,17 @@
#
-# Sample configuration file for mpd
-# This is a minimal configuration, see the manpage for more options
+# The configuration file is provided by the mpd package. This file
+# contains values that will override settings from the main config
+# file to make mpd startable in a default configuration.
#
-# Directory where the music is stored
-music_directory "/var/lib/mpd/music"
-
-# Directory where user-made playlists are stored (RW)
-playlist_directory "/var/lib/mpd/playlists"
-
-# Database file (RW)
-db_file "/var/lib/mpd/database"
-
# Log file (RW)
log_file "/var/log/mpd.log"
# Process ID file (RW)
pid_file "/var/run/mpd.pid"
-# State file (RW)
-state_file "/var/lib/mpd/state"
-
-# User id to run the daemon as
-#user "nobody"
-
-# TCP socket binding
-bind_to_address "any"
-#bind_to_address "localhost"
-
-# Unix socket to listen on
-bind_to_address "/var/lib/mpd/socket"
+# One output has to be defined
+audio_output {
+ type "null"
+ name "/dev/null"
+}
diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
index d063d509f4..d8e1d22611 100644
--- a/package/mpd/mpd.mk
+++ b/package/mpd/mpd.mk
@@ -345,8 +345,28 @@ else
MPD_CONF_OPTS += -Dzzip=disabled
endif
+# sed snippet from https://stackoverflow.com/a/37911473
+# single-line configurations will be inserted behind the last matching line
+# in the target file, multi-line blocks are just appended at the bottom.
define MPD_INSTALL_EXTRA_FILES
- $(INSTALL) -m 0644 -D package/mpd/mpd.conf $(TARGET_DIR)/etc/mpd.conf
+ $(INSTALL) -m 0644 -D $(@D)/doc/mpdconf.example $(TARGET_DIR)/etc/mpd.conf
+ export multiline=0
+ while read -r line; do \
+ if [[ $$line =~ ^[a-zA-Z] ]]; then \
+ if [ "$${line##*[[:space:]]}" == "{" ]; then \
+ export multiline=1; \
+ printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ else \
+ [ $$multiline ] && \
+ printf "\t%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ [ ! $$multiline ] && \
+ sed '/#'$${line%%[[:space:]]*}'[^\n]*/,$$!b;//{x;//p;g};//!H;$$!d;x;s||&\n'"$$line"'|' -i "$(TARGET_DIR)"/etc/mpd.conf; \
+ fi \
+ elif [ "$$line" == "}" ]; then \
+ printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ export multiline=0; \
+ fi \
+ done < package/mpd/mpd.conf
mkdir -p $(TARGET_DIR)/var/lib/mpd/music
mkdir -p $(TARGET_DIR)/var/lib/mpd/playlists
endef
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-08-27 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 3:26 [Buildroot] [PATCH v3 0/2] Add runtime test for mpd Andreas Ziegler
2026-08-27 3:26 ` Andreas Ziegler [this message]
2026-08-27 5:40 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Thomas Petazzoni via buildroot
2026-08-28 2:53 ` Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd Andreas Ziegler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827032643.1940-2-br025@umbiko.net \
--to=br025@umbiko.net \
--cc=buildroot@bubu1.eu \
--cc=buildroot@buildroot.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox