~ubuntu-branches/ubuntu/jaunty/cups/jaunty-proposed

« back to all changes in this revision

Viewing changes to debian/cups.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2009-02-15 18:39:03 UTC
  • mfrom: (6.1.30 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090215183903-i0nhvqyqj4vyn52a
Tags: 1.3.9-13
[ Till Kamppeter ]
* debian/local/filters/pdf-filters/filter/imagetopdf.c: Added support for
  the new "fit-to-page" option (new, more intuitive name for "fitplot").
* debian/filters/pstopdf: Only apply paper size if the "fitplot" or the
  "fit-to-page" option is set.
* debian/local/filters/cpdftocps: Only the last digit of the number of
  copies was used (LP: #309314).
* debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Do not preceed the
  PDF output with a newline (LP: #303691). Only impose the page size from
  the PPD file to all pages if the "fitplot" or the "fit-to-page" option is 
  set. This prevented from automatic paper tray switching to the correct paper
  sizes when a multiple-page-size document is printed (partial fix for
  LP: #310575).
* debian/patches/pdftops-cups-1.4.dpatch: Updated from CUPS 1.4 SVN. Contains
  fixes for multiple-page-size document printing (partial fix for
  LP: #310575).
* debian/patches/pdftops-dont_fail_on_cancel.dpatch: Removed, should be
  fixed in the new upstream version of pdftops.

[ Martin Pitt ]
* debian/patches/pdftops-cups-1.4.dpatch: Add definition of
  HAVE_PDFTOPS and CUPS_PDFTOPS, so that the filter actually gets
  again built with pdftops support. (Fixes Till's change from above).

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
 
157
157
#DEBHELPER#
158
158
 
 
159
if [ "$1" = configure ]; then
 
160
    # Do the following only if CUPS is running and the needed CUPS tools
 
161
    # are available
 
162
    if which lpstat > /dev/null 2>&1 && \
 
163
        which lpinfo > /dev/null 2>&1 && \
 
164
        which lpadmin > /dev/null 2>&1 && \
 
165
        lpstat -r > /dev/null 2>&1; then
 
166
        # Update the PPD files of all already installed print queues
 
167
        driverregexp='^lsb/usr/cups-included/'
 
168
        gennicknameregexp='s/,\s*\d+\.\d+[\d\.]*$//i'
 
169
        [ ! -z "$gennicknameregexp" ] && \
 
170
            gennicknameregexp="; $gennicknameregexp"
 
171
        gennicknameregexp='s/\s*\(recommended\)//'"$gennicknameregexp"
 
172
        tempfiles=
 
173
        trap 'rm -f $tempfiles; exit 0' 0 1 2 13 15
 
174
        tmpfile1=`mktemp -t updateppds.XXXXXX`
 
175
        tempfiles="$tempfiles $tmpfile1"
 
176
        lpinfo -m | grep -E $driverregexp > $tmpfile1
 
177
        cd /etc/cups/ppd
 
178
        for ppd in `ls -1 *.ppd 2>/dev/null`; do
 
179
            queue=${ppd%.ppd}
 
180
            nickname=`grep '\*NickName:' $ppd | cut -d '"' -f 2 | perl -p -e 's/\n$//' | perl -p -e "$gennicknameregexp" | perl -p -e 's/(\W)/\\\\$1/g'`
 
181
            lang=`grep '\*LanguageVersion:' $ppd | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
 
182
            ppdfound="0"
 
183
            englishppduri=""
 
184
            tmpfile2=`mktemp -t updateppds.XXXXXX`
 
185
            tempfiles="$tempfiles $tmpfile2"
 
186
            cat $tmpfile1 | perl -p -e "$gennicknameregexp" | grep -E '^\S+\s+.*'"$nickname"'$' | cut -d ' ' -f 1 > $tmpfile2
 
187
            while read newppduri; do
 
188
                [ "$ppdfound" = "0" ] && lpadmin -p $queue -m $newppduri
 
189
                newlang=`grep '\*LanguageVersion:' $ppd | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
 
190
                [ "$newlang" = "$lang" ] && ppdfound="1"
 
191
                [ "$newlang" = "english" ] && englishppduri="$newppduri"
 
192
            done < $tmpfile2
 
193
            [ "$ppdfound" = "0" ] && [ ! -z "$englishppduri" ] && lpadmin -p $queue -m $englishppduri && ppdfound="1"
 
194
            [ "$ppdfound" = "1" ] && echo PPD for printer $queue updated >&2
 
195
        done
 
196
    fi
 
197
fi
 
198
 
159
199
db_stop
160
200
exit 0
161
201