summaryrefslogtreecommitdiff
path: root/debian/foomatic-filters.config
diff options
context:
space:
mode:
Diffstat (limited to 'debian/foomatic-filters.config')
-rw-r--r--debian/foomatic-filters.config120
1 files changed, 120 insertions, 0 deletions
diff --git a/debian/foomatic-filters.config b/debian/foomatic-filters.config
new file mode 100644
index 0000000..9c53f24
--- /dev/null
+++ b/debian/foomatic-filters.config
@@ -0,0 +1,120 @@
+#!/bin/bash -e
+#
+# Debconf configuration script for the foomatic-filters package
+#
+
+. /usr/share/debconf/confmodule
+
+db_version 2.0
+db_capb backup
+db_title Foomatic Printer Filter Configuration
+
+declare -i state=1 backup=0
+
+function parseconfig
+{
+ if [ -e /usr/share/foomatic/parseconfig.pl ]; then
+ db_clear
+ eval $(/usr/bin/perl /usr/share/foomatic/parseconfig.pl)
+ db_set foomatic-filters/config_parsed true
+ else
+ db_set foomatic-filters/config_parsed false
+ fi
+}
+
+#################
+### Main loop ###
+#################
+
+parseconfig
+
+if [ -f /etc/foomatic/defaultspooler ]; then
+ db_set foomatic-filters/spooler `cat /etc/foomatic/defaultspooler`;
+else
+ # Try to detect from installed packages; use the one found first in
+ # the list
+ spooler=`dpkg-query --showformat='${Package} ${Status}' -W cupsys lpr lprng rlpr lpr-ppd pdq ppr 2>/dev/null | grep ' installed$' | cut -d' ' -f1 | head -1`
+ if [ "$spooler" = cupsys ]; then
+ spooler=cups
+ elif [ "$spooler" = lpr-ppd -o "$spooler" = lpr -o "$spooler" = rlpr ]; then
+ spooler=lpd
+ fi
+ if [ "$spooler" ]; then
+ db_set foomatic-filters/spooler $spooler
+ else
+ # This script may be run before dpkg gets around to installing
+ # a spooler if it is done in the same apt run, so see if anything
+ # is in the "install" state.
+ spooler=`dpkg-query --showformat='${Package} ${Status}' -W cupsys lpr lprng rlpr lpr-ppd pdq ppr 2>/dev/null | grep ' install ' | cut -d' ' -f1 | head -1`
+ if [ "$spooler" = "cupsys" ]; then
+ spooler=cups
+ elif [ "$spooler" = lpr-ppd -o "$spooler" = lpr -o "$spooler" = rlpr ]; then
+ spooler=lpd
+ fi
+ if [ "$spooler" ]; then
+ db_set foomatic-filters/spooler $spooler
+ fi
+ fi
+fi
+
+while ((state)); do
+ case $state in
+ 1)
+ db_input low foomatic-filters/spooler || true
+ ;;
+ 2)
+ db_input low foomatic-filters/filter_debug || true
+ ;;
+ 3)
+ db_get foomatic-filters/spooler;
+ if [ "$RET" = cups ]; then
+ ((backup ? state-- : state++ )) || true
+ continue
+ else
+ db_input low foomatic-filters/textfilter || true
+ fi
+ ;;
+ 4)
+ db_get foomatic-filters/textfilter;
+ if [ "$RET" = Custom ]; then
+ db_input low foomatic-filters/custom_textfilter || true
+ else
+ ((backup ? state-- : state++)) || true
+ continue
+ fi
+ ;;
+ 5)
+ db_input low foomatic-filters/gspath || true
+ ;;
+ 6)
+ db_get foomatic-filters/gspath;
+ if [ "$RET" = Custom ]; then
+ db_input low foomatic-filters/custom_gspath || true
+ else
+ ((backup ? state-- : state++)) || true
+ continue
+ fi
+ ;;
+ 7)
+ db_get foomatic-filters/spooler;
+ if [ "$RET" = cups ]; then
+ db_input low foomatic-filters/ps_accounting || true
+ else
+ ((backup ? state-- : state++)) || true
+ continue
+ fi
+ ;;
+ *)
+ break;
+ ;;
+ esac
+ backup=0
+ db_go || backup=1
+ ((backup ? state-- : state++))
+done
+
+db_stop
+
+### Local Variables:
+### tab-width: 4
+### End: