[Pkg-mpd-commits] [pkg-mpd] 04/06: transition away from START_MPD=false (closes: #738313)

Florian Schlichting fsfs at moszumanska.debian.org
Wed Feb 12 22:07:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

fsfs pushed a commit to branch master
in repository pkg-mpd.

commit ae47573bd4d81020f81d65984d5c15457d1e47b8
Author: Florian Schlichting <fsfs at debian.org>
Date:   Sun Feb 9 22:09:29 2014 +0100

    transition away from START_MPD=false (closes: #738313)
---
 debian/README.Debian         |  5 ++---
 debian/mpd.default           |  6 +++---
 debian/mpd.init.d            |  6 ------
 debian/mpd.lintian-overrides |  2 ++
 debian/mpd.preinst           | 18 ++++++++++++++++++
 5 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 20a00d7..976302a 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -7,9 +7,8 @@ directory configured for mpd. Then, request a database update, preferably
 through a client such as running "mpc update", or by restarting the mpd
 daemon.
 
-To prevent mpd from running as a system service, edit /etc/default/mpd and set
-"START_MPD=false" if you're using traditional sysvinit; in case of systemd,
-disable mpd.service by running "systemctl disable mpd.service". mpd is then
+To prevent mpd from running as a system service, disable its startup
+using the command (as root) "update-rc.d mpd disable". mpd is then
 started through the XDG autostart mechanism upon logging into your desktop
 environment, provided it can find a valid config file (such as ~/.mpdconf).
 
diff --git a/debian/mpd.default b/debian/mpd.default
index 30fbc3f..b3435db 100644
--- a/debian/mpd.default
+++ b/debian/mpd.default
@@ -1,9 +1,9 @@
 ## Defaults for the MPD init script, sourced by /etc/init.d/mpd on Debian
 ## systems.  Uncomment (remove the leading '#') and change values as needed.
 
-## Change this to prevent MPD from being started as a system service (for
-## example, if you want to run it from a regular user account)
-START_MPD=true
+## If you don't want MPD to be started as a system service (for example, if
+## you want to run it from a regular user account), disable it using the
+## command 'update-rc.d mpd disable'
 
 ## The configuration file location for mpd:
 # MPDCONF=/etc/mpd.conf
diff --git a/debian/mpd.init.d b/debian/mpd.init.d
index 8d296b9..ca18bd6 100644
--- a/debian/mpd.init.d
+++ b/debian/mpd.init.d
@@ -20,7 +20,6 @@ NAME=mpd
 DESC="Music Player Daemon"
 DAEMON=/usr/bin/mpd
 MPDCONF=/etc/mpd.conf
-START_MPD=true
 
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
@@ -37,11 +36,6 @@ DBFILE=$(sed -n 's/^[[:space:]]*db_file[[:space:]]*"\?\([^"]*\)\"\?/\1/p' $MPDCO
 PIDFILE=$(sed -n 's/^[[:space:]]*pid_file[[:space:]]*"\?\([^"]*\)\"\?/\1/p' $MPDCONF)
 
 mpd_start () {
-    if [ "$START_MPD" != "true" ]; then
-        log_action_msg "Not starting MPD: disabled by /etc/default/$NAME".
-        exit 0
-    fi
-
     log_daemon_msg "Starting $DESC" "$NAME"
 
     if [ -z "$PIDFILE" -o -z "$DBFILE" ]; then
diff --git a/debian/mpd.lintian-overrides b/debian/mpd.lintian-overrides
new file mode 100644
index 0000000..6694f3b
--- /dev/null
+++ b/debian/mpd.lintian-overrides
@@ -0,0 +1,2 @@
+# update-rc.d is only called on upgrade, which is not forbidden and actually makes sense here
+preinst-calls-updaterc.d mpd
diff --git a/debian/mpd.preinst b/debian/mpd.preinst
new file mode 100644
index 0000000..3274c25
--- /dev/null
+++ b/debian/mpd.preinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+ACTION="$1"
+VERSION="$2"
+
+# transition away from START_MPD=false (obsolete after jessie)
+if [ "$ACTION" = "upgrade" ]; then
+    [ -r /etc/default/mpd ] && . /etc/default/mpd
+    if [ "x$START_MPD" != "xtrue" ]; then
+        update-rc.d mpd disable > /dev/null
+        # attempt to reset /etc/default/mpd to unmodified state
+        sed -i -e's/^START_MPD=.*$/START_MPD=true/' /etc/default/mpd
+    fi
+fi
+
+#DEBHELPER#

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/pkg-mpd.git



More information about the Pkg-mpd-commits mailing list