[cups] how to disable automatic ppd updating
Narcis Garcia
informatica at actiu.net
Tue Oct 3 10:10:21 PDT 2017
To make system to preserve your customizations, you can:
a) Fork your PPDs with other file paths and names.
b) Redirect updates target for a file to be customized. i.e:
$ dpkg-divert --local --rename --add /usr/share/ppd/cupsfilters/pxlcolor.ppd
El 03/10/17 a les 18:38, Michael Pardee ha escrit:
> I don't know if this is a problem specific to the debian/ubuntu packaging,
> but when cups updates it updates my ppds, overwriting my custom changes.
> For example I have taken out the duplex options of a pcl 5c driver to
> create a queue with no duplex option, but when the cups package updates it
> regenerates the ppd and the duplex options are back in my ppds in
> /etc/cups/ppd.
>
> My question is: how should I properly disable the automatic ppd updating?
> Is there something in the header of the ppd that it is keying off of that I
> can change/delete? Do I need to back up and restore my custom ppds whenver
> I update cups? I don't want to disable the postinst cups script altogether.
>
>
>
> Here is the output when you updates the cups package:
>
> Setting up cups (2.1.3-4ubuntu0.3) ...
> Updating PPD files for cups ...
> Updating PPD files for cups-filters ...
> Updating PPD files for foomatic-db-compressed-ppds ...
> Updating PPD files for openprinting-ppds ...
> Updating PPD files for brlaser ...
> Updating PPD files for c2esp ...
> Updating PPD files for cups-pdf ...
> Updating PPD files for foo2zjs-common ...
> Updating PPD files for gutenprint ...
> PPD for printer bw updated
> PPD for printer bw_duplex updated
> Updating PPD files for hpcups ...
> PPD for printer youth updated
> PPD for printer youth_duplex updated
> Updating PPD files for hpijs ...
> Updating PPD files for postscript-hp ...
> Updating PPD files for ptouch ...
> Updating PPD files for pxljr ...
> Updating PPD files for sag-gdi ...
> Updating PPD files for splix ...
>
>
> And here is the section of the .deb postinst script that is doing the
> update:
>
> # ppd_updater is supposed to be launched only with a running CUPS.
> ppd_updater () {
> driverregexp="$1"
> gennicknameregexp="$2"
>
> [ ! -z "$gennicknameregexp" ] && \
> gennicknameregexp="; $gennicknameregexp"
> gennicknameregexp='s/\s*\(recommended\)//'"$gennicknameregexp"
> tmpfile1=`mktemp -t updateppds.XXXXXX`
> tempfiles="$tempfiles $tmpfile1"
> grep -E $driverregexp $tmpfile0 > $tmpfile1 || :
> cd /etc/cups/ppd
> for ppd in *.ppd; do
> [ -r "$ppd" ] || continue
> queue=${ppd%.ppd}
> lpstat -h /var/run/cups/cups.sock -p "$queue" >/dev/null 2>&1
> || continue
> nickname=`grep '\*NickName:' "$ppd" | cut -d '"' -f 2 | perl -p
> -e 's/\n$//' | perl -p -e "$gennicknameregexp" | perl -p -e
> 's/(\W)/\\\\$1/g'`
> lang=`grep '\*LanguageVersion:' "$ppd" | cut -d ' ' -f 2 | perl
> -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
> ppdfound="0"
> englishppduri=""
> tmpfile2=`mktemp -t updateppds.XXXXXX`
> tempfiles="$tempfiles $tmpfile2"
> cat $tmpfile1 | perl -p -e "$gennicknameregexp; s/\n*$/\n/s" |
> grep -E '^\S+\s+.*'"$nickname"'$' | cut -d ' ' -f 1 > $tmpfile2
> while read newppduri; do
> [ "$ppdfound" = "0" ] && lpadmin -h /var/run/cups/cups.sock
> -p "$queue" -m $newppduri 2>/dev/null || continue
> newlang=`grep '\*LanguageVersion:' "$ppd" | cut -d ' ' -f 2
> | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
> [ "$newlang" = "$lang" ] && ppdfound="1"
> [ "$newlang" = "english" ] && englishppduri="$newppduri"
> done < $tmpfile2
> [ "$ppdfound" = "0" ] && [ ! -z "$englishppduri" ] && lpadmin
> -h /var/run/cups/cups.sock -p "$queue" -m $englishppduri 2>/dev/null &&
> ppdfound="1"
> [ "$ppdfound" = "1" ] && echo PPD for printer $queue updated >&2
> done
> return 0
> }
>
>
>
> Here is the top part of one example ppd:
>
> *PPD-Adobe: "4.3"
> *% PPD file for CUPS/Gutenprint.
> *% Copyright 1993-2008 by Mike Sweet and Robert Krawitz.
> *% This program is free software; you can redistribute it and/or
> *% modify it under the terms of the GNU General Public License,
> *% version 2, as published by the Free Software Foundation.
> *%
> *% This program is distributed in the hope that it will be useful, but
> *% WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY
> *% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> *% for more details.
> *%
> *% You should have received a copy of the GNU General Public License
> *% along with this program; if not, write to the Free Software
> *% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
> USA.
> *%
> *FormatVersion: "4.3"
> *FileVersion: "5.2.11"
> *LanguageVersion: English
> *LanguageEncoding: ISOLatin1
> *PCFileName: "STP01766.PPD"
> *Manufacturer: "Generic"
> *Product: "(Generic PCL 5c Printer)"
> *ModelName: "Generic PCL 5c Printer"
> *ShortNickName: "Generic PCL 5c Printer"
> *NickName: "Generic PCL 5c Printer - CUPS+Gutenprint v5.2.11"
> *PSVersion: "(3010.000) 0"
> *LanguageLevel: "3"
> *ColorDevice: False
> *DefaultColorSpace: Gray
> *cupsManualCopies: True
> *FileSystem: False
> *LandscapeOrientation: Plus90
> *TTRasterizer: Type42
> *cupsVersion: 1.2
> *cupsFilter: "application/vnd.cups-raster 100 rastertogutenprint.5.2"
> *cupsLanguages: "ca cs da de el en_GB es fi fr gl hu it ja nb nl pl pt ru
> sk sl sv tr uk vi zh_CN zh_TW"
>
> *StpDriverName: "pcl-g_5c"
> *StpDriverModelFamily: "6_pcl"
> *StpPPDLocation:
> "/usr/share/cups/model/gutenprint/5.2/C/ppd/stp-pcl-g_5c.5.2.ppd"
> *StpLocale: "C"
> *VariablePaperSize: false
> ...
>
>
> Thanks,
> Michael Pardee
> Open Sense Solutions LLC
> http://open-sense.com
> 888-323-1742
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://lists.cups.org/mailman/listinfo/cups
>
More information about the cups
mailing list