summaryrefslogtreecommitdiff
path: root/debian/foomatic-filters.postinst
blob: ee80998a2a75d711fc0eb807bd10a698cd30b6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

readonly FILTERCONF=/etc/foomatic/filter.conf
readonly FILTERBACK=$FILTERCONF.debconf-old
readonly tempfile=`mktemp -t foomatic-filters-XXXXXX`

function parseconfig
{
    db_clear
    eval $(perl /usr/share/foomatic/parseconfig.pl)
}

db_get foomatic-filters/config_parsed
if [ $RET = false ]; then
    parseconfig
    db_set foomatic-filters/config_parsed true
fi

db_get foomatic-filters/filter_debug
debug="debug: 0"
if [ $RET = true ]; then
	debug="debug: 1"
fi

db_get foomatic-filters/textfilter
if [ "$RET" = Automagic ]; then
	textfilter="# textfilter:"
else
	if [ "$RET" = Custom ]; then
		db_get foomatic-filters/custom_textfilter
	fi
	textfilter="textfilter: $RET"
fi

# Disable the whole customized Ghostscript stuff
gspath="# gspath: gs"

db_get foomatic-filters/ps_accounting
if [ $RET = true ]; then
	ps_accounting="ps_accounting: 1"
else
	ps_accounting="ps_accounting: 0"
fi

ps_accounting="ps_accounting: 1"
RET=true
db_set foomatic-filters/ps_accounting true

db_get foomatic-filters/spooler
echo "$RET" >| /etc/foomatic/defaultspooler

cat <<EOF >| $tempfile
# This file allows you to configure the "foomatic-rip" filter.

# You can force reconfiguration managed via debconf by running the
# following command:
#   dpkg-reconfigure foomatic-filters
# You may need to change the lowest priority of questions to be presented
# using the switch "-p" to access some or any of these options.

# Command for converting text files to PostScript.
#
# Priority low
$textfilter

# Enable debug output into a logfile in /tmp/foomatic-rip.log.
# It will contain status from this filter, plus Ghostscript stderr output.
#
# WARNING: This logfile is a potential security hole; do not use in production.
#
# Priority low
$debug

# Enable insertion of PostScript code for accounting into each printjob.
# Currently only supported with CUPS. (EXPERIMENTAL)
#
# NOTE: Enabling this option may cause extra pages to be printed after each
# job as well as after banner pages, especially with generic
# PostScript printers.
#
# Priority low
$ps_accounting

# Path to the Ghostscript interpreter; will search the path for 'gs' if
# not specified.
#
# Priority low
$gspath

EOF

if [ -e $FILTERCONF ]; then
  chmod --reference=$FILTERCONF $tempfile
else
  chmod 0644 $tempfile
fi

ucf --three-way --debconf-ok $tempfile $FILTERCONF

db_stop

# Remove the temporary file
rm -f $tempfile

#DEBHELPER#

### Local Variables:
### tab-width: 4
### End: