[25953] in Source-Commits
/svn/athena r25317 - trunk/debathena/config/cupsys-config/debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Jul 29 10:12:15 2011
Date: Fri, 29 Jul 2011 10:11:48 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201107291411.p6TEBm6L029903@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
+ -- 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 \
+ -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
+ fi
+ done
+ for a in $ATHENA_PRINTERS; do
+ # Don't clobber queue, this is -cluster
+ if add-athena-printer $a; then
+ 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
+ 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
+ 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#
+
+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