aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2014-07-22 15:48:27 +0100
committerReuben Thomas <rrt@sc3d.org>2014-07-22 15:48:27 +0100
commit6876d60cdd17a7336c35df2e1769f9da0a98a324 (patch)
treea8c67e174610c13854a05a1a35a32a7104e94bbd
parentd7ca70692a35637e9efeae051951af7f30a05640 (diff)
downloadplptools-6876d60cdd17a7336c35df2e1769f9da0a98a324.tar.gz
plptools-6876d60cdd17a7336c35df2e1769f9da0a98a324.tar.bz2
plptools-6876d60cdd17a7336c35df2e1769f9da0a98a324.zip
Fix Debian bug #238921 about argument handling in init script
-rw-r--r--debian/changelog5
-rw-r--r--debian/plptools.init102
-rw-r--r--debian/plptools.postinst8
3 files changed, 56 insertions, 59 deletions
diff --git a/debian/changelog b/debian/changelog
index f3ead13..f4d8c50 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,8 +9,11 @@ plptools (1.0.13-0.1) unstable; urgency=low
* Add Japanese debconf translation. (Closes: #718756)
* Update packaging to debhelper 9, Debian policy 3.9.5.
(Closes: #727942)
+ * Fix handling of *_ARGS variables containing spaces in
+ /etc/default/plptools, and use correct flag to plpprintd for
+ print command. (Closes: #238921)
- -- Reuben Thomas <rrt@sc3d.org> Sun, 06 Jul 2014 23:02:57 +0100
+ -- Reuben Thomas <rrt@sc3d.org> Tue, 22 Jul 2014 15:47:33 +0100
plptools (1.0.9-2.4) unstable; urgency=low
diff --git a/debian/plptools.init b/debian/plptools.init
index cb66707..6124c9b 100644
--- a/debian/plptools.init
+++ b/debian/plptools.init
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/bash
### BEGIN INIT INFO
# Provides: plptools
# Required-Start: $remote_fs $syslog
@@ -28,88 +28,78 @@ test -f $CONFIG && . $CONFIG || exit 0
set -e
+plptools-run-daemon () {
+ daemon=$1
+ shift
+ # Get rid of empty first argument caused by leading white space or empty arguments
+ if test "$1" = ""; then shift; fi
+ echo -n "Starting $DESC ($daemon): "
+ start-stop-daemon --start --quiet \
+ --exec "$daemon" -- "$@" && \
+ echo -n "done" || echo -n "failed"
+ echo "."
+}
+
case "$1" in
- start)
+ start)
if test "$START_NCPD" = "yes" ; then
- echo -n "Starting $DESC ($NCPD): "
- start-stop-daemon --start --quiet \
- --exec $NCPD -- $NCPD_ARGS && \
- echo -n "done" || echo -n "failed"
- echo "."
- sleep 1
+ plptools-run-daemon "$NCPD" "${NCPD_ARGS[@]}"
+ sleep 1
fi
if test "$START_PLPFUSE" = "yes" ; then
- echo -n "Starting $DESC ($PLPFUSE): "
- start-stop-daemon --start --quiet \
- --exec $PLPFUSE -- $PLPFUSE_ARGS $MOUNTPOINT && \
- echo -n "done" || echo -n "failed"
- echo "."
+ plptools-run-daemon "$PLPFUSE" "${PLPFUSE_ARGS[@]}" "$MOUNTPOINT"
fi
if test "$START_PLPPRINTD" = "yes" ; then
- echo -n "Starting $DESC ($PLPPRINTD): "
- start-stop-daemon --start --quiet \
- --exec $PLPPRINTD -- $PLPPRINTD_ARGS && \
- echo -n "done" || echo -n "failed"
- echo "."
+ plptools-run-daemon "$PLPPRINTD" "${PLPPRINTD_ARGS[@]}"
fi
;;
- stop)
+ stop)
if test "$START_PLPFUSE" = "yes" ; then
- echo -n "Stopping $DESC ($PLPFUSE): "
- if [ "$(uname)" = Linux ]; then
- fusermount -z -u $MOUNTPOINT || true
- elif [ "$(uname)" = GNU/kFreeBSD ]; then
- umount $MOUNTPOINT || true
- else
- echo "Port me" >&2
- exit 1
- fi
- start-stop-daemon --stop --retry HUP/5/TERM/1 --quiet \
- --exec $PLPFUSE && \
- echo -n "done" || echo -n "already stopped"
- echo "."
+ echo -n "Stopping $DESC ($PLPFUSE): "
+ if [ "$(uname)" = Linux ]; then
+ fusermount -z -u "$MOUNTPOINT" || true
+ elif [ "$(uname)" = GNU/kFreeBSD ]; then
+ umount "$MOUNTPOINT" || true
+ else
+ echo "I don't know how to unmount a FUSE filing system on this OS" >&2
+ exit 1
+ fi
+ start-stop-daemon --stop --retry HUP/5/TERM/1 --quiet \
+ --exec "$PLPFUSE" && \
+ echo -n "done" || echo -n "already stopped"
+ echo "."
fi
if test "$START_PLPPRINTD" = "yes" ; then
- echo -n "Stopping $DESC ($PLPPRINTD): "
- start-stop-daemon --stop --quiet --exec $PLPPRINTD && \
- echo -n "done" || echo -n "already stopped"
- echo "."
+ echo -n "Stopping $DESC ($PLPPRINTD): "
+ start-stop-daemon --stop --quiet --exec "$PLPPRINTD" && \
+ echo -n "done" || echo -n "already stopped"
+ echo "."
fi
if test "$START_NCPD" = "yes" ; then
- echo -n "Stopping $DESC ($NCPD): "
- start-stop-daemon --stop --quiet --exec $NCPD && \
- echo -n "done" || echo -n "already stopped"
- echo "."
+ echo -n "Stopping $DESC ($NCPD): "
+ start-stop-daemon --stop --quiet --exec "$NCPD" && \
+ echo -n "done" || echo -n "already stopped"
+ echo "."
fi
-
- ;;
- reload)
;;
- restart|force-reload)
- #
- # If the "reload" option is implemented, move the "force-reload"
- # option to the "reload" entry above. If not, "force-reload" is
- # just the same as "restart".
- #
+ restart|force-reload)
$0 stop
sleep 1
$0 start
;;
- status)
+ status)
if "$START_NCPD" = "yes" ; then
- status_of_proc "$NCPD" ncpd || exit $?
+ status_of_proc "$NCPD" ncpd || exit $?
fi
if "$START_PLPFUSE" = "yes" ; then
- status_of_proc "$PLPFUSE" plpfuse || exit $?
+ status_of_proc "$PLPFUSE" plpfuse || exit $?
fi
if "$START_PLPPRINTD" = "yes" ; then
- status_of_proc "$PLPPRINTD" plpprintd || exit $?
+ status_of_proc "$PLPPRINTD" plpprintd || exit $?
fi
- exit 0
;;
- *)
+ *)
N=/etc/init.d/$NAME
- # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
diff --git a/debian/plptools.postinst b/debian/plptools.postinst
index 1a7d9f2..ea71767 100644
--- a/debian/plptools.postinst
+++ b/debian/plptools.postinst
@@ -72,10 +72,14 @@ case "$1" in
PLPPRINTD_ARGS="$FREM"
db_get plptools/plpprintd/printqueue
if [ "$RET" != "psion" ] ; then
- PLPPRINTD_ARGS="$PLPPRINTD_ARGS -s \"lpr -P$RET\""
+ PLPPRINTD_ARGS="$PLPPRINTD_ARGS -c 'lpr -P$RET'"
fi
fi
-# Move /etc/plptools.conf to /etc/default/plptools if it exists
+ # Strip leading whitespace from argument lists
+ NCPD_ARGS=${NCPD_ARGS## }
+ PLPFUSE_ARGS=${PLPFUSE_ARGS## }
+ PLPPRINTD_ARGS=${PLPPRINTD_ARGS## }
+ # Move /etc/plptools.conf to /etc/default/plptools if it exists
if test -f /etc/plptools.conf; then
mv /etc/plptools.conf /etc/default/plptools
fi