[25989] in Source-Commits
Re: /svn/athena r25317 -
daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Sat Jul 30 22:23:13 2011
Date: Sat, 30 Jul 2011 22:23:05 -0400 (EDT)
From: Benjamin Kaduk <kaduk@MIT.EDU>
To: Jonathan D Reed <jdreed@MIT.EDU>
cc: source-commits@MIT.EDU
In-Reply-To: <201107291411.p6TEBm6L029903@drugstore.mit.edu>
Message-ID: <alpine.GSO.1.10.1107302149120.7526@multics.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Fri, 29 Jul 2011, Jonathan D Reed wrote:
> Author: jdreed
> Date: 2011-07-29 10:11:47 -0400 (Fri, 29 Jul 2011)
> New Revision: 25317
>
> Added:
> trunk/debathena/config/cupsys-config/debian/configure-athena-printers
> trunk/debathena/config/cupsys-config/debian/debathena-cupsys-config.init
> trunk/debathena/config/cupsys-config/debian/preinst
> trunk/debathena/config/cupsys-config/debian/prerm
> Modified:
> trunk/debathena/config/cupsys-config/debian/changelog
> trunk/debathena/config/cupsys-config/debian/control.in
> trunk/debathena/config/cupsys-config/debian/install
> trunk/debathena/config/cupsys-config/debian/postinst
> trunk/debathena/config/cupsys-config/debian/rules
> Log:
> In cupsys-config:
> * Stop BrowsePolling and just add the mitprint printer. Remove any
> printers added by cluster-cups-config at upgrade time
> * Replace/Conflict/Provide debathena-cluster-cups-config
> * Bump standards-version
>
>
> Modified: trunk/debathena/config/cupsys-config/debian/changelog
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/changelog 2011-07-29 01:52:59 UTC (rev 25316)
> +++ trunk/debathena/config/cupsys-config/debian/changelog 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -1,12 +1,19 @@
> -debathena-cupsys-config (1.14) UNRELEASED; urgency=low
> +debathena-cupsys-config (1.14) unstable; urgency=low
>
> + [ Geoffrey Thomas ]
> * No need to make restart_cups.sh executable, since it's only intended
> to be included in other scripts and doesn't do anything if you
> execute it (since it just defines a function).
> This addresses Lintian warning executable-not-elf-or-script.
>
> - -- Geoffrey Thomas <geofft@mit.edu> Sat, 25 Jun 2011 04:49:45 -0400
> + [ Jonathan Reed ]
> + * Stop BrowsePolling and just add the mitprint printer. Remove any
> + printers added by cluster-cups-config at upgrade time
> + * Replace/Conflict/Provide debathena-cluster-cups-config
> + * Bump standards-version
Shouldn't there be a trac closer here -- this is #842, is it not?
>
> + -- Jonathan Reed <jdreed@mit.edu> Fri, 29 Jul 2011 08:23:43 -0400
> +
> debathena-cupsys-config (1.13) unstable; urgency=low
>
> * No changes, version bump to resolve 1.12 disparity issues
>
> Added: trunk/debathena/config/cupsys-config/debian/configure-athena-printers
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/configure-athena-printers (rev 0)
> +++ trunk/debathena/config/cupsys-config/debian/configure-athena-printers 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -0,0 +1,82 @@
> +#!/bin/sh
> +
> +PHAROS_PRINTERS="mitprint"
> +ATHENA_PRINTERS=
> +PRLIST="/var/lib/debathena-cupsys-config.added_printers"
> +
> +add_printers() {
> + rm -f $PRLIST
> + for p in $PHAROS_PRINTERS; do
> + lpadmin -p $p -E -v lpd://mitprint.mit.edu/bw \
I'm not really convinced that the PHAROS_PRINTERS abstraction meshes well
with this loop. Are we ever going to want to have two names for the bw
queue? with entirely the same options, now that we've moved away from
named queues for each physical printer hardware?
Certainly this will not work as-is when we get color capability.
> + -D "Pharos (Monochrome)" \
> + -L "Release jobs from any Pharos printer" \
> + -o printer-is-share=false \
> + -m drv:///hpijs.drv/hp-laserjet_9050-hpijs-pcl3.ppd
> + if [ $? != 0 ]; then
> + echo "FAILED to add Pharos printer $p"
> + else
> + echo "Added Pharos printer $p"
> + echo "$p" >> $PRLIST
The pedant in me wants the past-tense notice to go after the actual
addition (but I wouldn't have said anything if I wasn't writing mail
anyway).
> + fi
> + done
> + for a in $ATHENA_PRINTERS; do
> + # Don't clobber queue, this is -cluster
> + if add-athena-printer $a; then
You're mixing tabs and spaces, here. I'm also a little confused -- is the
sense of the comment reversed? It looks like we *are* clobbering any
existing queues of the same name ...
> + echo "Added Athena printer $a"
> + echo "$p" >> $PRLIST
> + else
> + echo "FAILED to add Athena printer $a"
> + fi
> + done
> +}
> +
> +del_printers() {
> + # Initially assume we remove nothing and the user can deal
> + PRINTERS_TO_REMOVE=
> + if [ -s $PRLIST ]; then
> + PRINTERS_TO_REMOVE=`cat $PRLIST`
> + fi
> + for p in $PRINTERS_TO_REMOVE; do
> + lpadmin -x $p
> + if [ $? != 0 ]; then
> + echo "Failed to remove printer $p!"
> + fi
> + done
> + rm -f $PRLIST
> +}
> +
> +require_cups() {
> + # Ensure CUPS is running
> + [ -e /etc/init.d/cups ] && rcname=cups || rcname=cupsys
> + if hash invoke-rc.d; then
> + invoke="invoke-rc.d $rcname"
> + else
> + invoke="/etc/init.d/$rcname"
> + fi
> + if ! /etc/init.d/$rcname status; then
I seem to recall that we just fixed code that presumed cups status ever
returned nonzero elsewhere ... we should perhaps have some common library
routines for these things, per #985.
> + if ! $invoke start; then
> + echo "FATAL: Couldn't start CUPS!"
> + exit 1
> + fi
> + fi
> + if [ "$(lpstat -r)" != "scheduler is running" ]; then
> + echo "FATAL: cups claimed to have started, but lpstat -r says it's not running!"
> + exit 1
> + fi
> +}
> +
> +case "$1" in
> + add)
> + require_cups
> + add_printers
> + ;;
> + remove)
> + require_cups
> + del_printers
> + ;;
> + *)
> + echo "Usage: $0 [ add | remove ]"
> + exit 1
> + ;;
> +esac
> +exit 0
>
>
> Property changes on: trunk/debathena/config/cupsys-config/debian/configure-athena-printers
> ___________________________________________________________________
> Added: svn:executable
> + *
>
> Modified: trunk/debathena/config/cupsys-config/debian/control.in
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/control.in 2011-07-29 01:52:59 UTC (rev 25316)
> +++ trunk/debathena/config/cupsys-config/debian/control.in 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -2,13 +2,16 @@
> Section: debathena-config/net
> Priority: extra
> Maintainer: Debathena Project <debathena@mit.edu>
> -Build-Depends: @cdbs@, debathena-cups, debathena-cupsys-hack
> -Standards-Version: 3.8.4
> +Build-Depends: @cdbs@, debathena-cups, debathena-cupsys-hack, config-package-dev (>= 4.12~)
> +Standards-Version: 3.9.1
>
> Package: debathena-cupsys-config
> Architecture: all
> -Depends: ${shlibs:Depends}, ${misc:Depends}, cups | cupsys, cups-bsd | cupsys-bsd
> -Provides: ${diverted-files}
> -Conflicts: ${diverted-files}
> +Depends: ${shlibs:Depends}, ${misc:Depends}, cups | cupsys, cups-bsd | cupsys-bsd, hpijs
> +Provides: ${diverted-files}, debathena-cluster-cups-config
> +Conflicts: ${diverted-files}, debathena-cluster-cups-config (<= 2.0.3)
> +Replaces: debathena-cluster-cups-config (<= 2.0.3)
> Description: CUPS configuration for Debathena
> - This package configures CUPS to use the cups.mit.edu CUPS server
> + This package configures centralized MIT printing. It doesn't
> + actually change the CUPS configuration anymore; the name is
> + historical.
>
> Added: trunk/debathena/config/cupsys-config/debian/debathena-cupsys-config.init
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/debathena-cupsys-config.init (rev 0)
> +++ trunk/debathena/config/cupsys-config/debian/debathena-cupsys-config.init 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -0,0 +1,42 @@
> +#! /bin/sh
> +
> +### BEGIN INIT INFO
> +# Provides: debathena-cupsys-config
> +# Required-Start: cups $remote_fs
> +# Required-Stop: cups $remote_fs
> +# Should-Start: $local_fs $network
> +# Default-Start: 2 3 4 5
> +# Default-Stop: 0 1 6
> +# Short-Description: CUPS configuration
> +# Description: Ensure printers exist
> +### END INIT INFO
> +
> +. /lib/lsb/init-functions
> +
> +case "$1" in
> + start)
> + if [ -f /var/lib/debathena-cupsys-config-reconfigure_required ]; then
> + log_action_msg "Adding MIT printers"
> + nologin=0
> + if [ ! -f /var/run/athena-nologin ]; then
> + touch /var/run/athena-nologin
> + nologin=1
Mixing tabs and spaces here, too.
> + fi
> + if /usr/lib/debathena-cupsys-config/configure-athena-printers add; then
> + rm -f /var/lib/debathena-cupsys-config-reconfigure_required
> + log_end_msg 0
> + else
> + log_end_msg 1
> + fi
> + [ $nologin -eq 1 ] && rm /var/run/athena-nologin
> + fi
> + ;;
> + stop|restart|reload|force-reload|status)
> + exit 0
> + ;;
> + *)
> + log_action_msg "Usage: /etc/init.d/debathena-cupsys-config {start}"
> + exit 1
> + ;;
> +esac
> +exit 0
>
>
> Property changes on: trunk/debathena/config/cupsys-config/debian/debathena-cupsys-config.init
> ___________________________________________________________________
> Added: svn:executable
> + *
>
> Modified: trunk/debathena/config/cupsys-config/debian/install
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/install 2011-07-29 01:52:59 UTC (rev 25316)
> +++ trunk/debathena/config/cupsys-config/debian/install 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -1,2 +1,2 @@
> debian/restart-cups.sh usr/lib/debathena-cupsys-config
> -debian/cupsd-site.conf usr/share/debathena-cupsys-config
> +debian/configure-athena-printers usr/lib/debathena-cupsys-config
>
> Modified: trunk/debathena/config/cupsys-config/debian/postinst
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/postinst 2011-07-29 01:52:59 UTC (rev 25316)
> +++ trunk/debathena/config/cupsys-config/debian/postinst 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -25,6 +25,15 @@
> case "$1" in
> configure)
> restart_cups
> + if [ "$(lpstat -r)" != "scheduler is running" ]; then
> + # CUPS isn't running even though it should be. We're probably
> + # inside the installer. Let the initscript deal.
> + touch /var/lib/debathena-cupsys-config-reconfigure_required
> + [ -x /usr/share/update-notifier/notify-reboot-required ] && \
> + /usr/share/update-notifier/notify-reboot-required
> + exit 0
> + fi
> + /usr/lib/debathena-cupsys-config/configure-athena-printers add
> ;;
>
> abort-upgrade|abort-remove|abort-deconfigure)
>
> Added: trunk/debathena/config/cupsys-config/debian/preinst
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/preinst (rev 0)
> +++ trunk/debathena/config/cupsys-config/debian/preinst 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -0,0 +1,41 @@
> +#!/bin/sh
> +# preinst script for debathena-cupsys-config
> +#
> +# see: dh_installdeb(1)
> +
> +set -e
> +
> +# summary of how this script can be called:
> +# * <new-preinst> `install'
> +# * <new-preinst> `install' <old-version>
> +# * <new-preinst> `upgrade' <old-version>
> +# * <old-preinst> `abort-upgrade' <new-version>
> +# for details, see http://www.debian.org/doc/debian-policy/ or
> +# the debian-policy package
> +
> +
> +case "$1" in
> + install|upgrade)
> + # If we're upgrading from < 1.14 and cluster-cups-config is there, nuke
> + # its printers to work around cluster-cups-config's broken prerm
> + if dpkg --compare-versions "$2" lt 1.14~ && \
> + [ -x /usr/share/debathena-cluster-cups-config/configure-athena-printers ]; then
> + /usr/share/debathena-cluster-cups-config/configure-athena-printers remove
> + fi
> + ;;
> +
> + abort-upgrade)
> + ;;
> +
> + *)
> + echo "preinst called with unknown argument \`$1'" >&2
> + exit 1
> + ;;
> +esac
> +
> +# dh_installdeb will replace this with shell code automatically
> +# generated by other debhelper scripts.
> +
> +#DEBHELPER#
> +
> +exit 0
>
> Added: trunk/debathena/config/cupsys-config/debian/prerm
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/prerm (rev 0)
> +++ trunk/debathena/config/cupsys-config/debian/prerm 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -0,0 +1,46 @@
> +#!/bin/sh
> +# prerm script for debathena-cupsys-config
> +#
> +# see: dh_installdeb(1)
> +
> +set -e
> +
> +# summary of how this script can be called:
> +# * <prerm> `remove'
> +# * <old-prerm> `upgrade' <new-version>
> +# * <new-prerm> `failed-upgrade' <old-version>
> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
> +# * <deconfigured's-prerm> `deconfigure' `in-favour'
> +# <package-being-installed> <version> `removing'
> +# <conflicting-package> <version>
> +# for details, see http://www.debian.org/doc/debian-policy/ or
> +# the debian-policy package
> +
> +
> +# dh_installdeb will replace this with shell code automatically
> +# generated by other debhelper scripts.
> +
> +#DEBHELPER#
Does it matter whether the #DEBHELPER# goes at the start or the end?
Otherwise things look pretty reasonable.
-Ben
> +
> +case "$1" in
> + remove|deconfigure)
> + if [ -z "$2" ]; then
> + /usr/lib/debathena-cupsys-config/configure-athena-printers remove
> + fi
> + ;;
> +
> + upgrade)
> + ;;
> +
> + failed-upgrade)
> + ;;
> +
> + *)
> + echo "prerm called with unknown argument \`$1'" >&2
> + exit 1
> + ;;
> +esac
> +
> +exit 0
> +
> +
>
> Modified: trunk/debathena/config/cupsys-config/debian/rules
> ===================================================================
> --- trunk/debathena/config/cupsys-config/debian/rules 2011-07-29 01:52:59 UTC (rev 25316)
> +++ trunk/debathena/config/cupsys-config/debian/rules 2011-07-29 14:11:47 UTC (rev 25317)
> @@ -2,12 +2,8 @@
>
> DEB_DIVERT_EXTENSION = .debathena
>
> -DEB_TRANSFORM_FILES_debathena-cupsys-config += \
> +DEB_UNDIVERT_FILES_debathena-cupsys-config += \
> /etc/cups/cupsd.conf.debathena
> -ifneq ($(wildcard /etc/cups/cupsd.conf.default),)
> - DEB_CHECK_FILES_SOURCE_/etc/cups/cupsd.conf.debathena = \
> - /etc/cups/cupsd.conf.default
> -endif
>
> include /usr/share/cdbs/1/rules/debhelper.mk
> include /usr/share/cdbs/1/rules/config-package.mk
>
>