[26565] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25629 - trunk/debathena/config/cupsys-config/debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Jul 9 10:42:44 2012

Date: Mon, 9 Jul 2012 10:42:42 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201207091442.q69EggEV024131@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-07-09 10:42:42 -0400 (Mon, 09 Jul 2012)
New Revision: 25629

Modified:
   trunk/debathena/config/cupsys-config/debian/changelog
   trunk/debathena/config/cupsys-config/debian/configure-athena-printers
   trunk/debathena/config/cupsys-config/debian/control.in
Log:
In cupsys-config:
  * Supply alternate PPDs for ancient distros (Trac: #1068)
  * Depends on hpijs-ppds, not hpijs (Trac: #1067)


Modified: trunk/debathena/config/cupsys-config/debian/changelog
===================================================================
--- trunk/debathena/config/cupsys-config/debian/changelog	2012-07-09 01:26:30 UTC (rev 25628)
+++ trunk/debathena/config/cupsys-config/debian/changelog	2012-07-09 14:42:42 UTC (rev 25629)
@@ -1,3 +1,10 @@
+debathena-cupsys-config (1.17.3) unstable; urgency=low
+
+  * Supply alternate PPDs for ancient distros (Trac: #1068)
+  * Depends on hpijs-ppds, not hpijs (Trac: #1067)
+
+ -- Jonathan Reed <jdreed@mit.edu>  Mon, 09 Jul 2012 10:42:19 -0400
+
 debathena-cupsys-config (1.17.2) unstable; urgency=low
 
   * No change rebuild to pick up config-package-dev 4.13 changes

Modified: trunk/debathena/config/cupsys-config/debian/configure-athena-printers
===================================================================
--- trunk/debathena/config/cupsys-config/debian/configure-athena-printers	2012-07-09 01:26:30 UTC (rev 25628)
+++ trunk/debathena/config/cupsys-config/debian/configure-athena-printers	2012-07-09 14:42:42 UTC (rev 25629)
@@ -4,29 +4,74 @@
 DEFAULT_PRINTER="mitprint"
 PRLIST="/var/lib/debathena-cupsys-config.added_printers"
 
+BW_PPDS="drv:///hpijs.drv/hp-laserjet_9050-hpijs-pcl3.ppd \
+         drv:///hpijs.drv/hp-laserjet_9050-hpijs.ppd"
+
+COLOR_PPDS="drv:///hpijs.drv/hp-color_laserjet_cp3525-hpijs-pcl3.ppd \
+            drv:///hpijs.drv/hp-color_laserjet_cp3505-hpijs.ppd"
+
+PPDCACHE="/var/tmp/debathena-cupsys-config-ppd-cache"
+
+select_ppd() {
+    [ -f "$PPDCACHE" ] && [ -r "$PPDCACHE" ] && [ -s "$PPDCACHE" ] || \
+	(rm -rf $PPDCACHE && lpinfo -m | cut -d ' ' -f 1 > $PPDCACHE)
+    first=1
+    ppd=
+    for p in $1; do
+	echo "trying $p"
+	if grep -qFx "$p" "$PPDCACHE"; then
+	    ppd=$p
+	    break
+	else
+	    first=0
+	fi
+    done
+    rv=0
+    [ -n "$ppd" ] && [ $first -ne 1 ] && rv=3
+    return $rv
+}
+
 add_printers() {
     rm -f $PRLIST
-    lpadmin -p mitprint -E -v lpd://mitprint.mit.edu/bw \
-	-D "Pharos (Monochrome)" \
-	-L "Release jobs from any Pharos B&W 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
+    ppd=
+    select_ppd "$BW_PPDS"
+    if [ $? -eq 3 ]; then
+	echo "NOTE: Using compatibility PPD for 'mitprint' printer" >&2
     fi
-    lpadmin -p mitprint-color -E -v lpd://mitprint.mit.edu/color \
-	-D "Pharos (Color)" \
-	-L "Release jobs from any Pharos Color printer" \
-	-o printer-is-share=false \
-	-m drv:///hpijs.drv/hp-color_laserjet_cp3525-hpijs-pcl3.ppd
-    if [ $? != 0 ]; then
-	echo "FAILED to add Pharos printer $p"
+    if [ -n "$ppd" ]; then
+	lpadmin -p mitprint -E -v lpd://mitprint.mit.edu/bw \
+	    -D "Pharos (Monochrome)" \
+	    -L "Release jobs from any Pharos B&W printer" \
+	    -o printer-is-share=false \
+	    -m "$ppd"
+	if [ $? != 0 ]; then
+	    echo "FAILED to add Pharos printer 'mitprint'" >&2
+	else
+	    echo "Added Pharos printer 'mitprint'" >&2
+	    echo "$p" >> $PRLIST
+	fi
+    else 
+	echo "Cannot add Pharos printer 'mitprint': no available PPDs!" >&2
+    fi
+    ppd=
+    select_ppd "$COLOR_PPDS"
+    if [ $? -eq 3 ]; then
+	echo "NOTE: Using compatibility driver for 'mitprint-color' printer" >&2
+    fi
+    if [ -n "$ppd" ]; then
+	lpadmin -p mitprint-color -E -v lpd://mitprint.mit.edu/color \
+	    -D "Pharos (Color)" \
+	    -L "Release jobs from any Pharos Color printer" \
+	    -o printer-is-share=false \
+	    -m "$ppd"
+	if [ $? != 0 ]; then
+	    echo "FAILED to add Pharos printer 'mitprint-color'" >&2
+	else
+	    echo "Added Pharos printer 'mitprint-color'" >&2
+	    echo "$p" >> $PRLIST
+	fi
     else
-	echo "Added Pharos printer $p"
-	echo "$p" >> $PRLIST
+	echo "Cannot add Pharos printer 'mitprint-color': no available PPDs!" >&2
     fi
     for a in $ATHENA_PRINTERS; do
         # Don't clobber queue, this is -cluster

Modified: trunk/debathena/config/cupsys-config/debian/control.in
===================================================================
--- trunk/debathena/config/cupsys-config/debian/control.in	2012-07-09 01:26:30 UTC (rev 25628)
+++ trunk/debathena/config/cupsys-config/debian/control.in	2012-07-09 14:42:42 UTC (rev 25629)
@@ -7,7 +7,7 @@
 
 Package: debathena-cupsys-config
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, cups | cupsys, cups-bsd | cupsys-bsd, hpijs
+Depends: ${shlibs:Depends}, ${misc:Depends}, cups | cupsys, cups-bsd | cupsys-bsd, hpijs-ppds
 Provides: ${diverted-files}, debathena-cluster-cups-config
 Conflicts: ${diverted-files}, debathena-cluster-cups-config (<= 2.0.4)
 Replaces: debathena-cluster-cups-config (<= 2.0.4)


home help back first fref pref prev next nref lref last post