[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XFree86 SVN commit: r1593 - trunk/debian



Author: branden
Date: 2004-07-07 03:58:08 -0500 (Wed, 07 Jul 2004)
New Revision: 1593

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/changelog
   trunk/debian/xdm.init
   trunk/debian/xdm.postinst.in
   trunk/debian/xfs.init
   trunk/debian/xfs.postinst.in
Log:
Fix xdm and xfs's init and postinst scripts in several respects.
+ Don't remove the "daemon not stopped" flag file in the postinst; we want
  to leave it there so it is seen by the next invocation of the init
  script (which is already written to remove it when needed).
+ Correct init scripts' notion of the name of the "daemon not stopped"
  flag file (completes change begun in 4.3.0.dfsg.1-1).
+ Use --name instead of --exec argument to start-stop-daemon when stopping
  a daemon that was not stopped across an upgrade (see #256790).
+ Fix misleading wording (and misleading variable name) in xdm postinst
  when refusing to start the daemon.

Clean up shell style and wrap lines at 80 columns.


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/CHANGESETS	2004-07-07 08:58:08 UTC (rev 1593)
@@ -98,4 +98,16 @@
 + Fix typo that kept the right Alt key from working.
     1588, 1589
 
+Fix xdm and xfs's init and postinst scripts in several respects.
++ Don't remove the "daemon not stopped" flag file in the postinst; we want
+  to leave it there so it is seen by the next invocation of the init
+  script (which is already written to remove it when needed).
++ Correct init scripts' notion of the name of the "daemon not stopped"
+  flag file (completes change begun in 4.3.0.dfsg.1-1).
++ Use --name instead of --exec argument to start-stop-daemon when stopping
+  a daemon that was not stopped across an upgrade (see #256790).
++ Fix misleading wording (and misleading variable name) in xdm postinst
+  when refusing to start the daemon.
+    1593
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/changelog	2004-07-07 08:58:08 UTC (rev 1593)
@@ -62,6 +62,17 @@
       "equal".
     + Fix typo that kept the right Alt key from working.
 
+  * Fix xdm and xfs's init and postinst scripts in several respects.
+    + Don't remove the "daemon not stopped" flag file in the postinst; we want
+      to leave it there so it is seen by the next invocation of the init
+      script (which is already written to remove it when needed).
+    + Correct init scripts' notion of the name of the "daemon not stopped"
+      flag file (completes change begun in 4.3.0.dfsg.1-1).
+    + Use --name instead of --exec argument to start-stop-daemon when stopping
+      a daemon that was not stopped across an upgrade (see #256790).
+    + Fix misleading wording (and misleading variable name) in xdm postinst
+      when refusing to start the daemon.
+
   Changes by Fabio Massimo Di Nitto:
 
   * Update French debconf template translations (thanks, Christian Perrier).
@@ -70,7 +81,7 @@
   * Update Brazilian Portuguese debconf template translations (thanks, Andre
     Luis Lopes). (Closes: #255963)
 
- -- Branden Robinson <branden@debian.org>  Mon, 28 Jun 2004 01:04:00 -0500
+ -- Branden Robinson <branden@debian.org>  Wed,  7 Jul 2004 03:49:10 -0500
 
 xfree86 (4.3.0.dfsg.1-5) unstable; urgency=low
 

Modified: trunk/debian/xdm.init
===================================================================
--- trunk/debian/xdm.init	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/xdm.init	2004-07-07 08:58:08 UTC (rev 1593)
@@ -11,10 +11,21 @@
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 DAEMON=/usr/bin/X11/xdm
 PIDFILE=/var/run/xdm.pid
-UPGRADEFILE=/var/run/xdm.upgrade
+UPGRADEFILE=/var/run/xdm.daemon-not-stopped
 
 test -x $DAEMON || exit 0
 
+stillrunning () {
+  if expr "$(cat /proc/$DAEMONPID/cmdline 2>/dev/null)" : "$DAEMON" >/dev/null \
+    2>&1; then
+    true
+  else
+    # if the daemon does not remove its own pidfile, we will
+    rm -f $PIDFILE $UPGRADEFILE
+    false
+  fi
+}
+
 # If we upgraded the daemon, we can't use the --exec argument to
 # start-stop-daemon since the inode will have changed.  The risk here is that
 # in a situation where the daemon died, its pidfile was not cleaned up, and
@@ -22,30 +33,24 @@
 # signals to an innocent process.  However, this seems like a corner case.
 # C'est la vie!
 if [ -e $UPGRADEFILE ]; then
-  SSD_ARGS="--pidfile $PIDFILE --startas $DAEMON"
+  SSD_START_ARGS="--pidfile $PIDFILE --startas $DAEMON"
+  SSD_STOP_ARGS="--pidfile $PIDFILE --name ${DAEMON#**/}"
 else
-  SSD_ARGS="--pidfile $PIDFILE --exec $DAEMON"
+  SSD_START_ARGS="--pidfile $PIDFILE --exec $DAEMON"
+  SSD_STOP_ARGS="$SSD_START_ARGS"
 fi
 
-stillrunning () {
-  if expr "$(cat /proc/$DAEMONPID/cmdline 2> /dev/null)" : "$DAEMON" > /dev/null 2>&1; then
-    true
-  else
-    # if the daemon does not remove its own pidfile, we will
-    rm -f $PIDFILE $UPGRADEFILE
-    false
-  fi;
-}
-
 case "$1" in
   start)
     if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
        [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
        [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
-      echo "Not starting X display manager (xdm); it is not the default display manager."
+      echo "Not starting X display manager (xdm); it is not the default" \
+        "display manager."
     else
       echo -n "Starting X display manager: xdm"
-      start-stop-daemon --start --quiet $SSD_ARGS || echo -n " already running"
+      start-stop-daemon --start --quiet $SSD_START_ARGS \
+        || echo -n " already running"
       echo "."
     fi
   ;;
@@ -62,7 +67,7 @@
 
   reload)
     echo -n "Reloading X display manager configuration..."
-    if start-stop-daemon --stop --signal 1 --quiet $SSD_ARGS; then
+    if start-stop-daemon --stop --signal 1 --quiet $SSD_STOP_ARGS; then
       echo "done."
     else
       echo "xdm not running."
@@ -82,7 +87,7 @@
       DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
       KILLCOUNT=1
       if [ ! -e $UPGRADEFILE ]; then
-        if start-stop-daemon --stop --quiet $SSD_ARGS; then
+        if start-stop-daemon --stop --quiet $SSD_STOP_ARGS; then
           # give xdm's signal handler a second to catch its breath
           sleep 1
         else

Modified: trunk/debian/xdm.postinst.in
===================================================================
--- trunk/debian/xdm.postinst.in	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/xdm.postinst.in	2004-07-07 08:58:08 UTC (rev 1593)
@@ -104,11 +104,11 @@
                      --exec /usr/bin/X11/xdm; then
   # Note our refusal to start the daemon if we were supposed to start it.
   [ -n "$NOSTART" ] || DENYSTART=yes
-  XDM_WHERE="pid $(cat /var/run/xdm.pid)"
+  DENIAL_REASON="xdm is already running at pid $(cat /var/run/xdm.pid)"
   if [ -d /var/state/xdm ]; then
-    warn "obsolete directory /var/state/xdm cannot be removed because xdm is" \
-         "still running at $XDM_WHERE; reinstall the xdm package (or remove" \
-         "the directory manually) when xdm is not running"
+    warn "obsolete directory /var/state/xdm cannot be removed because" \
+         "$DENIAL_REASON; reinstall the xdm package (or remove the directory" \
+         "manually) when xdm is not running"
   fi
 else
   if [ -d /var/state/xdm ]; then
@@ -125,7 +125,8 @@
           # Note our refusal to start the daemon if we were supposed to start
           # it.
           [ -n "$NOSTART" ] || DENYSTART=yes
-          XDM_WHERE="$DISPLAY, which xdm will attempt to manage"
+          DENIAL_REASON="an X server is already running at $DISPLAY, which" \
+                        "xdm is configured to to manage"
           break
         fi
       done
@@ -135,7 +136,7 @@
 
 # If the user wanted us to start the daemon but we refuse, explain why.
 if [ -n "$DENYSTART" ]; then
-  warn "not starting xdm because it is already running at $XDM_WHERE"
+  warn "not starting xdm because $DENIAL_REASON"
   NOSTART=yes
 fi
 
@@ -143,8 +144,9 @@
 
 #DEBHELPER#
 
-# Remove flag files.
-rm -f /var/run/xdm.install /var/run/xdm.daemon-not-stopped
+# Remove install flag file.  Leave the "daemon not stopped" flag file, if it
+# exists, so that it will be seen by the init script.
+rm -f /var/run/xdm.install
 
 exit 0
 

Modified: trunk/debian/xfs.init
===================================================================
--- trunk/debian/xfs.init	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/xfs.init	2004-07-07 08:58:08 UTC (rev 1593)
@@ -6,7 +6,7 @@
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 DAEMON=/usr/bin/X11/xfs
 PIDFILE=/var/run/xfs.pid
-UPGRADEFILE=/var/run/xfs.upgrade
+UPGRADEFILE=/var/run/xfs.daemon-not-stopped
 SOCKET_DIR=/tmp/.font-unix
 
 test -x $DAEMON || exit 0
@@ -23,13 +23,14 @@
 }
 
 stillrunning () {
-  if expr "$(cat /proc/$DAEMONPID/cmdline 2> /dev/null)" : "$DAEMON" > /dev/null 2>&1; then
+  if expr "$(cat /proc/$DAEMONPID/cmdline 2>/dev/null)" : "$DAEMON" >/dev/null \
+    2>&1; then
     true
   else
     # if the daemon does not remove its own pidfile, we will
     rm -f $PIDFILE $UPGRADEFILE
     false
-  fi;
+  fi
 }
 
 # If we upgraded the daemon, we can't use the --exec argument to
@@ -39,16 +40,19 @@
 # signals to an innocent process.  However, this seems like a corner case.
 # C'est la vie!
 if [ -e $UPGRADEFILE ]; then
-  SSD_ARGS="--pidfile $PIDFILE --startas $DAEMON"
+  SSD_START_ARGS="--pidfile $PIDFILE --startas $DAEMON"
+  SSD_STOP_ARGS="--pidfile $PIDFILE --name ${DAEMON#**/}"
 else
-  SSD_ARGS="--pidfile $PIDFILE --exec $DAEMON"
+  SSD_START_ARGS="--pidfile $PIDFILE --exec $DAEMON"
+  SSD_STOP_ARGS="$SSD_START_ARGS"
 fi
 
 case "$1" in
   start)
     set_up_socket_dir
     echo -n "Starting X font server: xfs"
-    start-stop-daemon --start --quiet $SSD_ARGS -- -daemon || echo -n " already running"
+    start-stop-daemon --start --quiet $SSD_START_ARGS -- -daemon \
+      || echo -n " already running"
     echo "."
   ;;
 
@@ -64,7 +68,7 @@
 
   reload)
     echo -n "Reloading X font server configuration..."
-    if start-stop-daemon --stop --signal 1 --quiet $SSD_ARGS; then
+    if start-stop-daemon --stop --signal 1 --quiet $SSD_STOP_ARGS; then
       echo "done."
     else
       echo "xfs not running."
@@ -84,7 +88,7 @@
       DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
       KILLCOUNT=1
       if [ ! -e $UPGRADEFILE ]; then
-        if start-stop-daemon --stop --quiet $SSD_ARGS; then
+        if start-stop-daemon --stop --quiet $SSD_STOP_ARGS; then
           # give xfs's signal handler a second to catch its breath
           sleep 1
         else

Modified: trunk/debian/xfs.postinst.in
===================================================================
--- trunk/debian/xfs.postinst.in	2004-07-07 08:44:19 UTC (rev 1592)
+++ trunk/debian/xfs.postinst.in	2004-07-07 08:58:08 UTC (rev 1593)
@@ -61,8 +61,9 @@
 
 #DEBHELPER#
 
-# Remove flag files.
-rm -f /var/run/xfs.install /var/run/xfs.daemon-not-stopped
+# Remove install flag file.  Leave the "daemon not stopped" flag file, if it
+# exists, so that it will be seen by the init script.
+rm -f /var/run/xfs.install
 
 exit 0
 



Reply to: