For discussion of Alpine Linux development and developer support

1

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

Peter Bui
Details
Message ID
<1426354898-15858-1-git-send-email-pnutzh4x0r@gmail.com>
Sender timestamp
1426354898
DKIM signature
missing
Download raw message
Patch: +5 -5
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
@@ -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 $?
 }
@@ -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
@@ -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@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20150316161528.41b58d60@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1426354898-15858-1-git-send-email-pnutzh4x0r@gmail.com> (view parent)
Sender timestamp
1426518928
DKIM signature
missing
Download raw message
On Sat, 14 Mar 2015 12:41:38 -0500
Peter Bui <pnutzh4x0r@gmail.com> wrote:

> 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(-)

committed and fixed checksum in APKBUILD

thanks!

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---