commit: 1c785a7a224d0c10ece09f4ee003e58609c5d62f Author: Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr> AuthorDate: Tue Feb 24 13:32:36 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Feb 27 15:18:35 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c785a7a
media-sound/mpd: fix new config w/o group defined group is no longer in mpd.conf because it overrides group(s) in user database update the initscript because it'll crash w/ a fresh install. Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr> Part-of: https://codeberg.org/gentoo/gentoo/pulls/130 Merges: https://codeberg.org/gentoo/gentoo/pulls/130 Signed-off-by: Sam James <sam <AT> gentoo.org> media-sound/mpd/files/mpd-0.24.8.init | 59 ++++++++++++++++++++++ .../{mpd-0.24.8.ebuild => mpd-0.24.8-r1.ebuild} | 16 ++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/media-sound/mpd/files/mpd-0.24.8.init b/media-sound/mpd/files/mpd-0.24.8.init new file mode 100644 index 000000000000..fcf8e8dc6528 --- /dev/null +++ b/media-sound/mpd/files/mpd-0.24.8.init @@ -0,0 +1,59 @@ +#!/sbin/openrc-run +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +: CFGFILE=${CFGFILE:=/etc/mpd.conf} + +depend() { + need localmount + use net netmount alsasound esound pulseaudio + config ${CFGFILE} +} + +get_config() { + x=$1 + test -e ${CFGFILE} || return 1 + sed -n \ + -e '/^[ \t]*'${x}'/{s:^[ \t]*'${x}'[ \t]\+"\?\([^#"]\+\)[^"]*"\?$:\1: ; {p;q} }' \ + ${CFGFILE} +} + +extra_started_commands='reload' +# Required by io_uring +rc_ulimit="-l 65535" +command=/usr/bin/mpd +command_args=${CFGFILE} +mpd_user="$(get_config user)" +required_files=${CFGFILE} +pidfile=$(get_config pid_file) +description="Music Player Daemon" + +check_config() { + if [ -z "$(get_config pid_file)" ]; then + eerror "pid_file must be set in ${CFGFILE}!" + return 1 + fi + if [ -z "$(get_config user)" ]; then + eerror "user must be set in ${CFGFILE}!" + return 1 + fi +} + +start_pre() { + check_config || return 1 + + local pid_dir="$(dirname "${pidfile}")" + checkpath -d -m 700 -o "${mpd_user}" "${pid_dir}" + + local log_file="$(get_config log_file)" + if [ -n "${log_file}" ] && [ "${log_file}" != "syslog" ]; then + local log_dir="$(dirname "${log_file}")" + checkpath -d -m 755 -o "${mpd_user}" "${log_dir}" + fi +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --pidfile ${pidfile} --signal HUP + eend $? +} diff --git a/media-sound/mpd/mpd-0.24.8.ebuild b/media-sound/mpd/mpd-0.24.8-r1.ebuild similarity index 94% rename from media-sound/mpd/mpd-0.24.8.ebuild rename to media-sound/mpd/mpd-0.24.8-r1.ebuild index ba26fea736e0..d707bb0cc26f 100644 --- a/media-sound/mpd/mpd-0.24.8.ebuild +++ b/media-sound/mpd/mpd-0.24.8-r1.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit flag-o-matic linux-info meson systemd xdg +inherit eapi9-ver flag-o-matic linux-info meson systemd xdg DESCRIPTION="The Music Player Daemon (mpd)" HOMEPAGE="https://www.musicpd.org https://github.com/MusicPlayerDaemon/MPD" @@ -296,7 +296,6 @@ src_install() { # When running MPD as system service, better switch to the user we provide sed -i \ -e 's:^#user.*$:user "mpd":' \ - -e 's:^#group.*$:group "audio":' \ "${ED}/etc/mpd.conf" || die if ! use systemd; then @@ -311,7 +310,7 @@ src_install() { insinto /etc/logrotate.d newins "${FILESDIR}/${PN}-0.23.15.logrotate" "${PN}" - newinitd "${FILESDIR}/${PN}-0.24.2.init" "${PN}" + newinitd "${FILESDIR}/${PN}-0.24.8.init" "${PN}" keepdir /var/lib/mpd keepdir /var/lib/mpd/music @@ -323,3 +322,14 @@ src_install() { fowners mpd:audio -R /var/lib/mpd fowners mpd:audio -R /var/log/mpd } + +pkg_postinst() { + xdg_pkg_postinst + + if ver_replacing -lt 0.24.8-r1; then + ewarn "The 'group' parameter is no longer used by default, because it" + ewarn "overrides the group(s) defined in the user database." + ewarn "Since the user 'mpd' is already part of the 'audio' group, please" + ewarn "consider removing 'group' parameter in ${EROOT}/etc/mpd.conf ." + fi +}
