From baa466e277f28aca7e9a27d7fd30c193d1996c0f Mon Sep 17 00:00:00 2001 From: Chris Lawrence Date: Sun, 1 Mar 2009 16:38:43 -0600 Subject: Imported Debian patch 4.0-20090301-1 --- debian/parseconfig.pl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 debian/parseconfig.pl (limited to 'debian/parseconfig.pl') diff --git a/debian/parseconfig.pl b/debian/parseconfig.pl new file mode 100644 index 0000000..b9854ee --- /dev/null +++ b/debian/parseconfig.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +my $configpath = "/etc/foomatic"; + +sub readConfFile +{ + my ($file) = @_; + + my %conf; + # Read config file if present + if (open CONF, "< $file") + { + while () + { + $conf{$1}="$2" if (m/^\s*([^\#\s]\S*)\s*:\s*(.*)\s*$/); + } + close CONF; + } + + return %conf; +} + +%conf = readConfFile("$configpath/filter.conf"); +print( 'db_set foomatic-filters/filter_debug ', + $conf{debug} > 0 ? 'true' : 'false', ";\n") if exists $conf{debug}; +if (exists $conf{textfilter}) +{ + if ($conf{textfilter} =~ m/^(a2ps|enscript|mpage)$/) + { + print "db_set foomatic-filters/textfilter $1;\n"; + } + elsif ($conf{textfilter} =~ m/^\s*$/) + { + print "db_set foomatic-filters/textfilter Automagic;\n"; + } + else + { + print "db_set foomatic-filters/textfilter Custom;\n"; + print "db_set foomatic-filters/custom_textfilter $conf{textfilter};\n"; + } +} +print( 'db_set foomatic-filters/ps_accounting ', + $conf{ps_accounting} ? 'true' : 'false', + "\n") if exists $conf{ps_accounting}; -- cgit v1.2.3