gentoo-ebuilds/media-sound/mpd/files/mpd-0.24.2.init
Nicolas PARLANT 3f83d2daec
media-sound/mpd: add 0.24.2
SRC_URI : use $(ver_cut 1-2)

iuse :
* rm cue, no dep
* rm fifo, no dep
* rm pipe, no dep
* rm udisks (this is only dbus)
* rm network (was httpd+shout, but this is two different plugins)
* rm yajl, it's used only with qobuz/snapcast/soundcloud
* add httpd
* add shout
* add tremor
* upstream prefers mpg123 over mad, so +mpg123
REQUIRED_USE :
* soundcloud don't require qobuz

deps :
* boost is not longer required
* libogg is required only for opus/tremor/vorbis
* for qobuz, select ffmpeg/libgcrypt with ffmpeg/!ffmpeg
* media-libs/libsidplay is no longer supported (masked for ppc/ppc64)
* twolame/lame are only required for httpd/shout/recorder

documentation :
* add sphinx-rtd-theme
* set HTML_DOCS
* use manpages from DISTFILES if !doc

initscript :
* use eerror and return 1 for failures
* stop sed of mpd.conf after the first occurence of 'user'

Closes: https://bugs.gentoo.org/939943
Closes: https://bugs.gentoo.org/944145
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-08 10:32:11 +01:00

64 lines
1.5 KiB
Text

#!/sbin/openrc-run
# Copyright 1999-2025 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)"
mpd_group="$(get_config group)"
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
if [ -z "$(get_config group)" ]; then
eerror "group 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}:${mpd_group}" "${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}:${mpd_group}" "${log_dir}"
fi
}
reload() {
ebegin "Reloading ${RC_SVCNAME}"
start-stop-daemon --pidfile ${pidfile} --signal HUP
eend $?
}