summaryrefslogtreecommitdiff
path: root/init.d/mpd
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-05-04 10:01:34 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-05-04 10:01:34 -0300
commit31ee4472e897cbf0c3d61bd56bd5864f4507b659 (patch)
tree5b0a8af5189ea1b88a36e9b909f3933899d9a1cf /init.d/mpd
re-initial
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'init.d/mpd')
-rwxr-xr-xinit.d/mpd32
1 files changed, 32 insertions, 0 deletions
diff --git a/init.d/mpd b/init.d/mpd
new file mode 100755
index 0000000..d2a7654
--- /dev/null
+++ b/init.d/mpd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+: CFGFILE=${CFGFILE:=${XDG_CONFIG_HOME:-${HOME}/.config}/mpd/mpd.conf}
+
+depend() {
+ use pipewire pulseaudio
+ config ${CFGFILE}
+}
+
+get_config() {
+ x=$1
+ test -e ${CFGFILE} || return 1
+ sed -n \
+ -e '/^[ \t]*'${x}'/{s:^[ \t]*'${x}'[ \t]\+"\?\([^#"]\+\)[^"]*"\?$:\1: ; p }' \
+ ${CFGFILE}
+}
+
+extra_started_commands='reload'
+# Required by io_uring
+command=/usr/bin/mpd
+command_args=${CFGFILE}
+required_files=${CFGFILE}
+pidfile=$(get_config pid_file)
+description="Music Player Daemon"
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ start-stop-daemon --pidfile ${pidfile} --signal HUP
+ eend $?
+}