~ubuntu-branches/ubuntu/precise/foomatic-filters/precise-proposed

« back to all changes in this revision

Viewing changes to debian/foomatic-filters.postinst.in

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud, Translation updates
  • Date: 2011-02-09 15:38:14 UTC
  • mfrom: (1.2.4 upstream) (6.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110209153814-noiljpseb0kzdlzs
Tags: 4.0.6-1
* Upload to unstable.

[ Translation updates ]
* Japanese: Indent correctly.

* Explicitly depend on bash (Closes: #600179)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
set -e
 
4
 
 
5
# Source debconf library.
 
6
. /usr/share/debconf/confmodule
 
7
 
 
8
readonly FILTERCONF=/etc/foomatic/filter.conf
 
9
readonly FILTERBACK=$FILTERCONF.debconf-old
 
10
readonly tempfile=`tempfile -pfoomatic-filters-`
 
11
 
 
12
function parseconfig
 
13
{
 
14
    db_clear
 
15
    eval $(perl /usr/share/foomatic/parseconfig.pl)
 
16
}
 
17
 
 
18
db_get foomatic-filters/config_parsed
 
19
if [ $RET = false ]; then
 
20
    parseconfig
 
21
    db_set foomatic-filters/config_parsed true
 
22
fi
 
23
 
 
24
db_get foomatic-filters/filter_debug
 
25
debug="debug: 0"
 
26
if [ $RET = true ]; then
 
27
        debug="debug: 1"
 
28
fi
 
29
 
 
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
 
39
 
 
40
# Disable the whole customized Ghostscript stuff
 
41
gspath="# gspath: gs"
 
42
 
 
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
 
49
 
 
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
 
59
 
 
60
 
 
61
db_get foomatic-filters/spooler
 
62
echo "$RET" >| /etc/foomatic/defaultspooler
 
63
 
 
64
cat <<EOF >| $tempfile
 
65
# This file allows you to configure the "foomatic-rip" filter.
 
66
 
 
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.
 
72
 
 
73
# Command for converting text files to PostScript.
 
74
#
 
75
# Priority low
 
76
$textfilter
 
77
 
 
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
 
85
 
 
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
 
95
 
 
96
# Path to the Ghostscript interpreter; will search the path for 'gs' if
 
97
# not specified.
 
98
#
 
99
# Priority low
 
100
$gspath
 
101
 
 
102
EOF
 
103
 
 
104
if [ -e $FILTERCONF ]; then
 
105
  chmod --reference=$FILTERCONF $tempfile
 
106
else
 
107
  chmod 0644 $tempfile
 
108
fi
 
109
 
 
110
ucf --three-way --debconf-ok $tempfile $FILTERCONF
 
111
 
 
112
db_stop
 
113
 
 
114
# Remove the temporary file
 
115
rm -f $tempfile
 
116
 
 
117
#DEBHELPER#
 
118
 
 
119
### Local Variables:
 
120
### tab-width: 4
 
121
### End: