Mail archive
alpine-devel

[alpine-devel] [PATCH] main/mpd: fix pidfile, change to system user

From: Peter Bui <pnutzh4x0r_at_gmail.com>
Date: Sat, 14 Mar 2015 12:41:38 -0500

1. Fix handling of pidfile (parsing and creation of directory on start)

2. Make mpd a system user (similar to minidlna)
---
 main/mpd/mpd.initd       | 7 ++++---
 main/mpd/mpd.pre-install | 3 +--
 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/main/mpd/mpd.initd b/main/mpd/mpd.initd
index f18708b..a026d72 100644
--- a/main/mpd/mpd.initd
+++ b/main/mpd/mpd.initd
_at_@ -19,16 +19,18 @@ checkconfig() {
 }
 
 get_pidfile() {
-	pidfile=$(awk '$1 == "pid_file" { print $2 }' "$CONF")
+	pidfile=$(awk '$1 == "pid_file" { print $2 }' "$CONF" | sed 's/"//')
 	pidfile=${pidfile:-/var/run/mpd/$NAME.pid}
 }
 
 start() {
 	checkconfig || return 1
 	get_pidfile
+	checkpath --owner ${M_USER:-mpd}:${M_GROUP:-audio} \
+		--directory ${pidfile%/*}
+
 	ebegin "Starting ${NAME}"
 		start-stop-daemon --start --quiet \
-			--pidfile $pidfile\
 			--exec ${DAEMON} -- ${MPD_OPTS}
 	eend $?
 }
_at_@ -39,4 +41,3 @@ stop() {
 		mpd --kill
 	eend $?
 }
-
diff --git a/main/mpd/mpd.pre-install b/main/mpd/mpd.pre-install
index cb1b8d3..70bddb2 100644
--- a/main/mpd/mpd.pre-install
+++ b/main/mpd/mpd.pre-install
_at_@ -1,4 +1,3 @@
 #!/bin/sh
 
-adduser -h /var/lib/mpd -s /sbin/nologin -G audio -D mpd 2>/dev/null || true
-
+adduser -S -h /var/lib/mpd -s /sbin/nologin -G audio -D mpd 2>/dev/null || true
-- 
2.3.2
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Sat Mar 14 2015 - 12:41:38 GMT