[25481] in Source-Commits
/svn/athena r25012 - trunk/debathena/config/cluster-cups-config/debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Mar 9 17:51:39 2011
Date: Wed, 9 Mar 2011 17:51:33 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201103092251.p29MpX7F008887@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-03-09 17:51:33 -0500 (Wed, 09 Mar 2011)
New Revision: 25012
Added:
trunk/debathena/config/cluster-cups-config/debian/configure-athena-printers
trunk/debathena/config/cluster-cups-config/debian/preinst
Removed:
trunk/debathena/config/cluster-cups-config/debian/classes.conf
trunk/debathena/config/cluster-cups-config/debian/printers.conf
Modified:
trunk/debathena/config/cluster-cups-config/debian/changelog
trunk/debathena/config/cluster-cups-config/debian/control.in
trunk/debathena/config/cluster-cups-config/debian/install
trunk/debathena/config/cluster-cups-config/debian/postinst
trunk/debathena/config/cluster-cups-config/debian/prerm
Log:
In cluster-cups-config:
* Stop shipping our own printers.conf and classes.conf; instead use
lpadmin and add-athena-printer (Trac: #841)
* Fix the broken prerm by cleaning up in the preinst for pre-2.0
packages
* No more printername2 queues for legacy LPRng printers
Modified: trunk/debathena/config/cluster-cups-config/debian/changelog
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/changelog 2011-03-09 20:50:22 UTC (rev 25011)
+++ trunk/debathena/config/cluster-cups-config/debian/changelog 2011-03-09 22:51:33 UTC (rev 25012)
@@ -1,3 +1,13 @@
+debathena-cluster-cups-config (2.0) unstable; urgency=low
+
+ * Stop shipping our own printers.conf and classes.conf; instead use
+ lpadmin and add-athena-printer (Trac: #841)
+ * Fix the broken prerm by cleaning up in the preinst for pre-2.0
+ packages
+ * No more printername2 queues for legacy LPRng printers
+
+ -- Jonathan Reed <jdreed@mit.edu> Wed, 09 Mar 2011 17:23:01 -0500
+
debathena-cluster-cups-config (1.3) unstable; urgency=low
* Add the mitprint queue back, and also make the Pharos pilot queues
Added: trunk/debathena/config/cluster-cups-config/debian/configure-athena-printers
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/configure-athena-printers (rev 0)
+++ trunk/debathena/config/cluster-cups-config/debian/configure-athena-printers 2011-03-09 22:51:33 UTC (rev 25012)
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+PHAROS_PRINTERS="mitprint bias nysa python savion"
+ATHENA_PRINTERS="acantha ajax albany amittai ashdown avery barbar barker bob \
+ boomboom bricks celine clearcut corfu e55prt echo edgerton \
+ eie electra fiber getitfaster hayden helios homer jarthur \
+ jonathan katharine laser lerman lotis macg maia \
+ mark-the-great massave mccormick metis mortar nhdesk pacific \
+ peecs picus pietro pindar pulp pulp-fiction quick-print \
+ sanda sidney simmons stumpgrinder sum thesis \
+ tree-eater ussy varan virus w20thesis w61cluster w84prt \
+ waffle westgate wg-tang wh-print wired"
+
+add_printers() {
+ 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"
+ fi
+ done
+ for a in $ATHENA_PRINTERS; do
+ if add-athena-printer $a; then
+ echo "Added Athena printer $a"
+ else
+ echo "FAILED to add Athena printer $a"
+ fi
+ done
+}
+
+del_printers() {
+ for p in $PHAROS_PRINTERS $ATHENA_PRINTERS; do
+ lpadmin -x $p;
+ if [ $? != 0 ]; then
+ echo "Failed to remove printer $p!"
+ fi
+ done
+}
+
+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
+}
+
+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/cluster-cups-config/debian/configure-athena-printers
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/debathena/config/cluster-cups-config/debian/control.in
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/control.in 2011-03-09 20:50:22 UTC (rev 25011)
+++ trunk/debathena/config/cluster-cups-config/debian/control.in 2011-03-09 22:51:33 UTC (rev 25012)
@@ -7,7 +7,7 @@
Package: debathena-cluster-cups-config
Architecture: all
-Depends: ${misc:Depends}, debathena-cupsys-config (>= 1.12~)
+Depends: ${misc:Depends}, debathena-cupsys-config (>= 1.12~), debathena-printing-config, hpijs
Provides: ${diverted-files}
Conflicts: ${diverted-files}
Description: CUPS configuration for Athena cluster machines
Modified: trunk/debathena/config/cluster-cups-config/debian/install
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/install 2011-03-09 20:50:22 UTC (rev 25011)
+++ trunk/debathena/config/cluster-cups-config/debian/install 2011-03-09 22:51:33 UTC (rev 25012)
@@ -1,3 +1,2 @@
-debian/classes.conf usr/share/debathena-cluster-cups-config
-debian/printers.conf usr/share/debathena-cluster-cups-config
+debian/configure-athena-printers usr/share/debathena-cluster-cups-config
debian/cupsd-site.conf.debathena usr/share/debathena-cupsys-config
Modified: trunk/debathena/config/cluster-cups-config/debian/postinst
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/postinst 2011-03-09 20:50:22 UTC (rev 25011)
+++ trunk/debathena/config/cluster-cups-config/debian/postinst 2011-03-09 22:51:33 UTC (rev 25012)
@@ -1,5 +1,5 @@
#!/bin/sh
-# postinst script for #PACKAGE#
+# postinst script for debathena-cluster-cups-config
#
# see: dh_installdeb(1)
@@ -25,34 +25,10 @@
. /usr/lib/debathena-cupsys-config/restart-cups.sh
-restart_cups_extra()
-{
- # CUPS needs to not be running while we do this.
- if [ "$1" -gt 0 ]; then
- echo "CUPS is running and cannot be stopped automatically!" >&2
- echo "Please shut down CUPS and retry configuring this package." >&2
- return 1
- fi
-
- # Make a directory to back up the old printers/classes.conf if we
- # haven't previously done so.
- if ! [ -e /etc/cups/debathena-cluster-cups-config-saved ]; then
- mkdir /etc/cups/debathena-cluster-cups-config-saved
- for file in printers.conf printers.conf.O classes.conf classes.conf.O; do
- if [ -e /etc/cups/"$file" ]; then
- mv /etc/cups/"$file" /etc/cups/debathena-cluster-cups-config-saved
- fi
- done
- fi
- # However, unconditionally copy printers.conf and classes.conf so we
- # pick up changes in them.
- cp /usr/share/debathena-cluster-cups-config/printers.conf /etc/cups
- cp /usr/share/debathena-cluster-cups-config/classes.conf /etc/cups
-}
-
case "$1" in
configure)
restart_cups
+ /usr/share/debathena-cluster-cups-config/configure-athena-printers add
;;
abort-upgrade|abort-remove|abort-deconfigure)
Added: trunk/debathena/config/cluster-cups-config/debian/preinst
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/preinst (rev 0)
+++ trunk/debathena/config/cluster-cups-config/debian/preinst 2011-03-09 22:51:33 UTC (rev 25012)
@@ -0,0 +1,65 @@
+#!/bin/sh
+# preinst script for deabthena-cluster-cups-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
+
+
+. /usr/lib/debathena-cupsys-config/restart-cups.sh
+
+restart_cups_extra ()
+{
+ # CUPS needs to not be running while we do this.
+ if [ "$1" -gt 0 ]; then
+ echo "CUPS is running and cannot be stopped automatically!" >&2
+ echo "Please shut down CUPS and retry deconfiguring this package." >&2
+ return 1
+ fi
+
+ for file in printers.conf printers.conf.O classes.conf classes.conf.O; do
+ if [ -e /etc/cups/"$file" ]; then
+ rm /etc/cups/"$file"
+ fi
+ done
+
+ if [ -d /etc/cups/debathena-cluster-cups-config-saved ]; then
+ find /etc/cups/debathena-cluster-cups-config-saved -mindepth 1 \
+ -exec mv {} /etc/cups \;
+ fi
+ # And nuke the directory so the old prerm doesn't fail
+ rm -rf /etc/cups/debathena-cluster-cups-config-saved
+}
+
+
+case "$1" in
+ install|upgrade)
+ # On an upgrade, cleanup after pre-2.0 versions
+ if dpkg --compare-versions "$2" lt-nl 2.0~; then
+ restart_cups
+ 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
Modified: trunk/debathena/config/cluster-cups-config/debian/prerm
===================================================================
--- trunk/debathena/config/cluster-cups-config/debian/prerm 2011-03-09 20:50:22 UTC (rev 25011)
+++ trunk/debathena/config/cluster-cups-config/debian/prerm 2011-03-09 22:51:33 UTC (rev 25012)
@@ -1,5 +1,5 @@
#!/bin/sh
-# prerm script for #PACKAGE#
+# prerm script for debathena-cluster-cups-config
#
# see: dh_installdeb(1)
@@ -22,32 +22,11 @@
#DEBHELPER#
-. /usr/lib/debathena-cupsys-config/restart-cups.sh
-
-restart_cups_extra ()
-{
- # CUPS needs to not be running while we do this.
- if [ "$1" -gt 0 ]; then
- echo "CUPS is running and cannot be stopped automatically!" >&2
- echo "Please shut down CUPS and retry deconfiguring this package." >&2
- return 1
- fi
-
- for file in printers.conf printers.conf.O classes.conf classes.conf.O; do
- if [ -e /etc/cups/"$file" ]; then
- rm /etc/cups/"$file"
- fi
- done
- if [ -d /etc/cups/debathena-cluster-cups-config-saved ]; then
- mv /etc/cups/debathena-cluster-cups-config-saved/* /etc/cups
- fi
-}
-
-. /usr/lib/debathena-cupsys-config/restart-cups.sh
-
case "$1" in
remove|deconfigure)
- restart_cups
+ if [ -z "$2" ]; then
+ /usr/share/debathena-cluster-cups-config/configure-athena-printers remove
+ fi
;;
upgrade)