[Pkg-cups-devel] r89 - cupsys/branches/cups-1.2/debian

Martin Pitt mpitt at costa.debian.org
Thu Dec 22 11:42:49 UTC 2005


Author: mpitt
Date: Thu Dec 22 11:42:47 2005
New Revision: 89

Modified:
   cupsys/branches/cups-1.2/debian/changelog
   cupsys/branches/cups-1.2/debian/cupsys.default
   cupsys/branches/cups-1.2/debian/cupsys.init.d
   cupsys/branches/cups-1.2/debian/cupsys.postinst
Log:
* Move forcefully killing of cupsd if start-stop-daemon fails from
  postinst to init script, where it belongs to. Do not kill all running
  cupsd processes, but only the one in the pid file; this will unbreak cupsd
  behaviour in chroots.
* debian/cupsys.default: Remove obsolete FORCE_RESTART option.



Modified: cupsys/branches/cups-1.2/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2/debian/changelog	(original)
+++ cupsys/branches/cups-1.2/debian/changelog	Thu Dec 22 11:42:47 2005
@@ -18,8 +18,13 @@
 
   [ Martin Pitt ]
   * debian/patches/02_configure.dpatch: Adapt to r4885.
+  * Move forcefully killing of cupsd if start-stop-daemon fails from
+    postinst to init script, where it belongs to. Do not kill all running
+    cupsd processes, but only the one in the pid file; this will unbreak cupsd
+    behaviour in chroots.
+  * debian/cupsys.default: Remove obsolete FORCE_RESTART option.
 
- -- Kenshi Muto <kmuto at debian.org>  Thu, 15 Dec 2005 07:15:54 +0900
+ -- Martin Pitt <martin.pitt at ubuntu.com>  Thu, 22 Dec 2005 12:36:27 +0100
 
 cupsys (1.1.99.b1.r4876-1) unstable; urgency=low
 

Modified: cupsys/branches/cups-1.2/debian/cupsys.default
==============================================================================
--- cupsys/branches/cups-1.2/debian/cupsys.default	(original)
+++ cupsys/branches/cups-1.2/debian/cupsys.default	Thu Dec 22 11:42:47 2005
@@ -1,7 +1 @@
 # Cups configure options
-
-# cupsys forces stop cupsd when it looks lock-up during upgrade installation.
-# If your cupsd is running outside of current environment (such as chroot),
-# maybe this behavior is unnecessary for you.
-# You can disable this force-stop working by FORCE_RESTART=no
-FORCE_RESTART=yes

Modified: cupsys/branches/cups-1.2/debian/cupsys.init.d
==============================================================================
--- cupsys/branches/cups-1.2/debian/cupsys.init.d	(original)
+++ cupsys/branches/cups-1.2/debian/cupsys.init.d	Thu Dec 22 11:42:47 2005
@@ -24,12 +24,35 @@
 	chown root:lpadmin /usr/share/cups/model 2>/dev/null || true
 	chmod 3775 /usr/share/cups/model 2>/dev/null || true
 	start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON
-	log_end_msg $?
 	;;
   stop)
 	log_begin_msg "Stopping $DESC: $NAME"
+        if [ -e $PIDFILE ]; then
+            read pid < "$PIDFILE" || true
+        fi
 	start-stop-daemon --stop --quiet --user root --retry TERM/10 --oknodo --pidfile $PIDFILE --name $NAME
-	log_end_msg $?
+        SSR=$?
+
+        # cupsd is hard to kill sometimes
+        if [ -n "$pid" ]; then
+            if ps -p "$pid" > /dev/null 2>&1; then
+                log_warning_msg "Cups is still running, waiting 5 seconds..."
+                sleep 5
+                if ps -p "$pid" > /dev/null 2>&1; then
+                    log_warning_msg "Forcefully killing cupsd..."
+                    kill -9 "$pid"
+                    sleep 1
+                    if ps -p "$pid" > /dev/null 2>&1; then
+                        log_end_msg 1
+                        exit 1
+                    else
+                        log_end_msg 0
+                    fi
+                fi
+            fi
+        else
+	    log_end_msg $SSR
+        fi
 	;;
   reload)
 	log_begin_msg "Reloading $DESC: $NAME"

Modified: cupsys/branches/cups-1.2/debian/cupsys.postinst
==============================================================================
--- cupsys/branches/cups-1.2/debian/cupsys.postinst	(original)
+++ cupsys/branches/cups-1.2/debian/cupsys.postinst	Thu Dec 22 11:42:47 2005
@@ -35,22 +35,6 @@
 	[ -f /etc/cups/printers.conf.save ] && mv /etc/cups/printers.conf.save /etc/cups/printers.conf
 	[ -f /etc/cups/classes.conf.save ] && mv /etc/cups/classes.conf.save /etc/cups/classes.conf
 
-	if [ "$FORCE_RESTART" = "yes" ]; then
-    	  # Check cupsys is really stopped... stupid
-	  if [ -n "`pidof /usr/sbin/cupsd`" ]; then
-	    echo "Cupsys is still running... waiting 5 seconds..."
-	    sleep 5
-            if [ -n "`pidof /usr/sbin/cupsd`" ]; then
- 	      echo "Killing cupsys..."
-	      kill -9 `pidof /usr/sbin/cupsd` || true
-              sleep 1
-	    fi
-	  fi
-	  if [ -n "`ps aux | grep /usr/sbin/cupsd | grep -v grep`" ]; then
-	    echo "Hmm, cupsys (or some forked processes) won't stop. Please stop them manually."
-	    exit 1
-	  fi
-	fi
 	# Set up lpadmin group.
 	if [ -z "`getent group lpadmin`" ]; then 
 	    addgroup --system lpadmin



More information about the Pkg-cups-devel mailing list