Author: branden Date: 2004-04-11 19:18:02 -0500 (Sun, 11 Apr 2004) New Revision: 1232
Modified: trunk/debian/changelog trunk/debian/xfs.postinst.in trunk/debian/xfs.postrm.in trunk/debian/xfs.preinst.in trunk/debian/xfs.prerm.in Log: Improve xfs package's maintainer scripts: + Replace xfs "upgrade" flag file with two distinct ones, "install" and "daemon-not-stopped". Create install flag file when preinst script is invoked with "install" argument; remove in postinst, and in postrm when invoked with "abort-install" or "abort-upgrade" argument. Create "daemon-not-stopped" flag file in prerm script if the daemon is not stopped with invoke-rc.d; remove in postinst, and in postrm when invoked with "abort-upgrade" argument. (Closes: #241539) + Duplicate the postinst's daemon logic in the postrm when invoked with the "abort-upgrade" argument; this way the daemon is restarted if it was stopped for upgrade, but the upgrade failed. + Pass package name literally to update-rc.d and invoke-rc.d; quiets lintian warning. + Use shell's && and || operators instead of test(1)'s -a and -o operators, since the former is POSIX-compliant and the latter is not. + Wrap lines at 80 columns. + Improve comments. + Update Vim modelines. + Add SVN Id keyword and set corresponding property. Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2004-04-11 23:57:05 UTC (rev 1231) +++ trunk/debian/changelog 2004-04-12 00:18:02 UTC (rev 1232) @@ -136,8 +136,24 @@ to use the invoke-rc.d command instead of invoking packages' init scripts directly. - -- Branden Robinson <[EMAIL PROTECTED]> Sun, 11 Apr 2004 18:35:50 -0500 + * Improve xfs package's maintainer scripts: + + Replace xfs "upgrade" flag file with two distinct ones, "install" and + "daemon-not-stopped". Create install flag file when preinst script is + invoked with "install" argument; remove in postinst, and in postrm when + invoked with "abort-install" or "abort-upgrade" argument. Create + "daemon-not-stopped" flag file in prerm script if the daemon is not + stopped with invoke-rc.d; remove in postinst, and in postrm when invoked + with "abort-upgrade" argument. (Closes: #241539) + + Duplicate the postinst's daemon logic in the postrm when invoked with + the "abort-upgrade" argument; this way the daemon is restarted if it was + stopped for upgrade, but the upgrade failed. + + Pass package name literally to update-rc.d and invoke-rc.d; quiets + lintian warning. + + Use shell's && and || operators instead of test(1)'s -a and -o operators, + since the former is POSIX-compliant and the latter is not. + -- Branden Robinson <[EMAIL PROTECTED]> Sun, 11 Apr 2004 19:13:49 -0500 + xfree86 (4.3.0-7) unstable; urgency=medium * Urgency due to fix for FTBFS. Yes -- I too am begging for it to stop. Modified: trunk/debian/xfs.postinst.in =================================================================== --- trunk/debian/xfs.postinst.in 2004-04-11 23:57:05 UTC (rev 1231) +++ trunk/debian/xfs.postinst.in 2004-04-12 00:18:02 UTC (rev 1232) @@ -1,10 +1,12 @@ #!/bin/sh # Debian xfs package post-installation script -# Copyright 1998-2001 Branden Robinson. +# Copyright 1998--2001, 2004 Branden Robinson. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>. # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. +# $Id$ + set -e THIS_PACKAGE=xfs @@ -18,7 +20,8 @@ check_symlinks_and_bomb /usr/X11R6/lib/X11/fs # now safe to finish migrations started in preinst -if [ -e /usr/X11R6/lib/X11/fs.moved-by-preinst -a -L /usr/X11R6/lib/X11/fs ]; then +if [ -e /usr/X11R6/lib/X11/fs.moved-by-preinst ] && \ + [ -L /usr/X11R6/lib/X11/fs ]; then rm -r /usr/X11R6/lib/X11/fs.moved-by-preinst fi if [ -e /etc/X11/xfs.moved-by-preinst ]; then @@ -27,32 +30,39 @@ # deal with a bug in very old versions of xbase for DIR in rc0.d rc1.d rc6.d; do - if [ -L /etc/$DIR/K1xfs ]; then - mv /etc/$DIR/K1xfs /etc/$DIR/K01xfs + if [ -L "/etc/$DIR/K1xfs" ]; then + mv "/etc/$DIR/K1xfs" "/etc/$DIR/K01xfs" fi done if [ -e /etc/init.d/xfs ]; then - update-rc.d $THIS_PACKAGE defaults + update-rc.d xfs defaults fi # restarting the daemon may cause output to stdout db_stop NOSTART= -# don't start xfs if we are upgrading without stopping it -if [ -e /var/run/xfs.upgrade ]; then - NOSTART=yes +# If we are not installing, we may or may not need to restart the daemon, but we +# always start the daemon on install. +if [ ! -e /var/run/xfs.install ]; then + # Don't start the daemon if it wasn't stopped... + if [ -e /var/run/xfs.daemon-not-stopped ]; then + NOSTART=yes + fi + # ...or if the options file says not to. + if ! fgrep -qsx "restart-on-upgrade" /etc/X11/fs/xfs.options; then + NOSTART=yes + fi fi -# or if the options file says not to -if ! grep -qs "^restart-on-upgrade" /etc/X11/fs/xfs.options; then - NOSTART=yes -fi -[ -n "$NOSTART" ] || invoke-rc.d $THIS_PACKAGE start || true +[ -n "$NOSTART" ] || invoke-rc.d xfs start || true #DEBHELPER# +# Remove flag files. +rm -f /var/run/xfs.install /var/run/xfs.daemon-not-stopped + exit 0 -# vim:set ai et sts=2 sw=2 tw=0: +# vim:set ai et sts=2 sw=2 tw=80: Property changes on: trunk/debian/xfs.postinst.in ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/debian/xfs.postrm.in =================================================================== --- trunk/debian/xfs.postrm.in 2004-04-11 23:57:05 UTC (rev 1231) +++ trunk/debian/xfs.postrm.in 2004-04-12 00:18:02 UTC (rev 1232) @@ -1,10 +1,12 @@ #!/bin/sh # Debian xfs package post-removal script -# Copyright 1998-2001 Branden Robinson. +# Copyright 1998--2001, 2004 Branden Robinson. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>. # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. +# $Id$ + set -e THIS_PACKAGE=xfs @@ -12,26 +14,53 @@ #INCLUDE_SHELL_LIB# -if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ]; then - if [ -d /usr/X11R6/lib/X11/fs.moved-by-preinst -a -L /usr/X11R6/lib/X11/fs ]; then +if [ "$1" = "abort-install" ] || [ "$1" = "abort-upgrade" ]; then + if [ -d /usr/X11R6/lib/X11/fs.moved-by-preinst ] && \ + [ -L /usr/X11R6/lib/X11/fs ]; then rm /usr/X11R6/lib/X11/fs mv /usr/X11R6/lib/X11/fs.moved-by-preinst /usr/X11R6/lib/X11/fs fi - if [ -e /etc/X11/xfs.moved-by-preinst -a -d /etc/X11/fs -a ! -e /etc/X11/xfs ]; then + if [ -e /etc/X11/xfs.moved-by-preinst ] && [ -d /etc/X11/fs ] && \ + [ ! -e /etc/X11/xfs ]; then mv /etc/X11/fs /etc/X11/xfs rm /etc/X11/xfs.moved-by-preinst fi + fi +if [ "$1" = "abort-install" ]; then + rm -f /var/run/xfs.install +fi + #DEBHELPER# if [ "$1" = "purge" ]; then - update-rc.d $THIS_PACKAGE remove + update-rc.d xfs remove if [ -d /etc/X11/fs ]; then rm -r /etc/X11/fs fi fi +# NOTE: The following is copied from the postinst script and isn't necessary if +# dpkg executes a package's postinst script with the "configure" argument after +# unwinding from a failed upgrade. (See section 6.5 of the Debian Policy +# Manual, "Details of unpack phase of installation or upgrade".) +if [ "$1" = "abort-upgrade" ]; then + # Don't start the daemon if it wasn't stopped... + if [ -e /var/run/xfs.daemon-not-stopped ]; then + NOSTART=yes + fi + # ...or if the options file says not to. + if ! fgrep -qsx "restart-on-upgrade" /etc/X11/fs/xfs.options; then + NOSTART=yes + fi + + [ -n "$NOSTART" ] || invoke-rc.d xfs start || true + + # Remove flag files. + rm -f /var/run/xfs.install /var/run/xfs.daemon-not-stopped +fi + exit 0 -# vim:set ai et sts=2 sw=2 tw=0: +# vim:set ai et sts=2 sw=2 tw=80: Property changes on: trunk/debian/xfs.postrm.in ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/debian/xfs.preinst.in =================================================================== --- trunk/debian/xfs.preinst.in 2004-04-11 23:57:05 UTC (rev 1231) +++ trunk/debian/xfs.preinst.in 2004-04-12 00:18:02 UTC (rev 1232) @@ -1,10 +1,12 @@ #!/bin/sh # Debian xfs package pre-installation script -# Copyright 1998-2001 Branden Robinson. +# Copyright 1998--2001, 2004 Branden Robinson. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>. # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. +# $Id$ + set -e THIS_PACKAGE=xfs @@ -12,7 +14,7 @@ #INCLUDE_SHELL_LIB# -if [ "$1" = "install" -o "$1" = "upgrade" ]; then +if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then # fs dir moved to /etc/X11 in 4.x if [ -e /usr/X11R6/lib/X11/fs -a ! -L /usr/X11R6/lib/X11/fs ]; then observe "removing obsolete /usr/X11R6/lib/X11/fs directory" @@ -30,8 +32,14 @@ check_symlinks_and_warn /usr/X11R6/lib/X11/fs fi +if [ "$1" = "install" ]; then + # Create a flag file that tells the postinst script this is an install, not + # an upgrade. + : >/var/run/xfs.install +fi + #DEBHELPER# exit 0 -# vim:set ai et sts=2 sw=2 tw=0: +# vim:set ai et sts=2 sw=2 tw=80: Property changes on: trunk/debian/xfs.preinst.in ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/debian/xfs.prerm.in =================================================================== --- trunk/debian/xfs.prerm.in 2004-04-11 23:57:05 UTC (rev 1231) +++ trunk/debian/xfs.prerm.in 2004-04-12 00:18:02 UTC (rev 1232) @@ -1,10 +1,12 @@ #!/bin/sh # Debian xfs package pre-removal script -# Copyright 1998-2001 Branden Robinson. +# Copyright 1998--2001, 2004 Branden Robinson. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>. # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. +# $Id$ + set -e THIS_PACKAGE=xfs @@ -22,19 +24,23 @@ esac STOP= -# are we supposed to restart on upgrade? if removing xfs, we don't care -if grep -qs ^restart-on-upgrade /etc/X11/fs/xfs.options || [ -n "$REMOVING" ]; then +# Are we supposed to restart on upgrade? If removing the package, we always +# stop the daemon. +if grep -qs ^restart-on-upgrade /etc/X11/fs/xfs.options || \ + [ -n "$REMOVING" ]; then STOP=yes fi if [ -n "$STOP" ]; then - invoke-rc.d $THIS_PACKAGE stop || true + invoke-rc.d xfs stop || true else - touch /var/run/xfs.upgrade + # Create a flag file that tells the postinst and postrm scripts that the + # daemon was not stopped. + : >/var/run/xfs.daemon-not-stopped fi #DEBHELPER# exit 0 -# vim:set ai et sts=2 sw=2 tw=0: +# vim:set ai et sts=2 sw=2 tw=80: Property changes on: trunk/debian/xfs.prerm.in ___________________________________________________________________ Name: svn:keywords + Id