From: Jason Pleau Date: Fri, 1 May 2015 21:11:15 +0000 (-0400) Subject: update init script and systemd service file X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=5abfdfda7b2c9fac25dd2db7115a3796a15c8eb9;p=ympd.git update init script and systemd service file init script: depend on $remote_fs instead of $local_fs. Reason: /usr can be mounted a remote filesystem. Also depend on mpd (instead of $mpd, which doesn't seem to exist.. at least on my system) Also provide a default config (which should be installed as /etc/default/ympd) This commit makes the systemd unit file as well as the init script load values from this configuration file so the user can change ympd settings easily when running it as a service. --- diff --git a/contrib/init.debian b/contrib/init.debian index 517c25f..5fac553 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -1,8 +1,8 @@ #!/bin/sh ### BEGIN INIT INFO # Provides: ympd -# Required-Start: $local_fs $mpd -# Required-Stop: $local_fs $mpd +# Required-Start: $remote_fs mpd +# Required-Stop: $remote_fs mpd # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Daemonized version of ympd. @@ -20,8 +20,11 @@ PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME LOG_OUT=/var/log/$NAME.out LOG_ERR=/var/log/$NAME.err -YMPD_USER=mpd -DAEMON_OPT="--user $YMPD_USER --webport 8080" +YMPD_USER=nobody +MPD_HOST=localhost +MPD_PORT=6600 +WEB_PORT=8080 + # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -32,6 +35,8 @@ DAEMON_OPT="--user $YMPD_USER --webport 8080" # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS +DAEMON_OPT="--user $YMPD_USER --webport $MPD_WEBHOST --host $MPD_HOST --port $MPD_PORT" + do_start() { start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \ diff --git a/contrib/ympd.default b/contrib/ympd.default new file mode 100644 index 0000000..c7bbcda --- /dev/null +++ b/contrib/ympd.default @@ -0,0 +1,4 @@ +MPD_HOST=localhost +MPD_PORT=6600 +WEB_PORT=8080 +YMPD_USER=nobody diff --git a/contrib/ympd.service b/contrib/ympd.service index 5d44c17..b39f0c9 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -6,8 +6,9 @@ Requires=network.target local-fs.target Environment=MPD_HOST=localhost Environment=MPD_PORT=6600 Environment=WEB_PORT=8080 -EnvironmentFile=-/etc/conf.d/ympd -ExecStart=/usr/bin/ympd -h $MPD_HOST -p $MPD_PORT -w $WEB_PORT +Environment=YMPD_USER=nobody +EnvironmentFile=/etc/default/ympd +ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $MPD_WEBHOST --host $MPD_HOST --port $MPD_PORT Type=simple [Install]