2a5d21de6fee772d324f2aa8ff326473d57cf378
1 #!/bin/bash
3 set -e
5 # Source debconf library.
6 . /usr/share/debconf/confmodule
8 readonly FILTERCONF=/etc/foomatic/filter.conf
9 readonly FILTERBACK=$FILTERCONF.debconf-old
10 readonly tempfile=`tempfile -pfoomatic-filters-`
12 function parseconfig
13 {
14 db_clear
15 eval $(perl /usr/share/foomatic/parseconfig.pl)
16 }
18 db_get foomatic-filters/config_parsed
19 if [ $RET = false ]; then
20 parseconfig
21 db_set foomatic-filters/config_parsed true
22 fi
24 db_get foomatic-filters/filter_debug
25 debug="debug: 0"
26 if [ $RET = true ]; then
27 debug="debug: 1"
28 fi
30 db_get foomatic-filters/textfilter
31 if [ "$RET" = Automagic ]; then
32 textfilter="# textfilter:"
33 else
34 if [ "$RET" = Custom ]; then
35 db_get foomatic-filters/custom_textfilter
36 fi
37 textfilter="textfilter: $RET"
38 fi
40 # Disable the whole customized Ghostscript stuff
41 gspath="# gspath: gs"
43 db_get foomatic-filters/ps_accounting
44 if [ $RET = true ]; then
45 ps_accounting="ps_accounting: 1"
46 else
47 ps_accounting="ps_accounting: 0"
48 fi
50 # Since foomatic-filters #FF_PS_DEFAULT_CHANGE_VERSION# in #MOTHER_DISTRO#,
51 # the default for inserting PostScript code for CUPS' page accounting changed.
52 # This functionality is now activated by default as for problematic drivers it
53 # can be deactivated individually.
54 if dpkg --compare-versions "$2" lt-nl "#FF_PS_DEFAULT_CHANGE_VERSION#"; then
55 ps_accounting="ps_accounting: 1"
56 RET=true
57 db_set foomatic-filters/ps_accounting true
58 fi
61 db_get foomatic-filters/spooler
62 echo "$RET" >| /etc/foomatic/defaultspooler
64 cat <<EOF >| $tempfile
65 # This file allows you to configure the "foomatic-rip" filter.
67 # You can force reconfiguration managed via debconf by running the
68 # following command:
69 # dpkg-reconfigure foomatic-filters
70 # You may need to change the lowest priority of questions to be presented
71 # using the switch "-p" to access some or any of these options.
73 # Command for converting text files to PostScript.
74 #
75 # Priority low
76 $textfilter
78 # Enable debug output into a logfile in /tmp/foomatic-rip.log.
79 # It will contain status from this filter, plus Ghostscript stderr output.
80 #
81 # WARNING: This logfile is a potential security hole; do not use in production.
82 #
83 # Priority low
84 $debug
86 # Enable insertion of PostScript code for accounting into each printjob.
87 # Currently only supported with CUPS. (EXPERIMENTAL)
88 #
89 # NOTE: Enabling this option may cause extra pages to be printed after each
90 # job as well as after banner pages, especially with generic
91 # PostScript printers.
92 #
93 # Priority low
94 $ps_accounting
96 # Path to the Ghostscript interpreter; will search the path for 'gs' if
97 # not specified.
98 #
99 # Priority low
100 $gspath
102 EOF
104 if [ -e $FILTERCONF ]; then
105 chmod --reference=$FILTERCONF $tempfile
106 else
107 chmod 0644 $tempfile
108 fi
110 ucf --three-way --debconf-ok $tempfile $FILTERCONF
112 db_stop
114 # Remove the temporary file
115 rm -f $tempfile
117 #DEBHELPER#
119 ### Local Variables:
120 ### tab-width: 4
121 ### End:
