#!/bin/bash # # Debconf configuration script for the foomatic-filters package # set -e . /usr/share/debconf/confmodule db_version 2.0 db_capb backup db_settitle foomatic-filters/title declare -i state=1 backup=0 function parseconfig { if [ -e /usr/share/foomatic/parseconfig.pl ]; then db_clear eval $(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 cups 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 cups 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_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: