[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: User interaction in postinst



Tollef Fog Heen <tollef@add.no> writes:

> * Roger Leigh 
> 
> | >From what I have read about debconf, the questions it asks are static.
> | However, in this case, I can't generate the questions until the
> | package is installed: the translations are gettext .mo files in the
> | gimpprint-locales package (which may be not installed or incomplete),
> | and the list of printer drivers is extracted from libgimpprint.so.1 by
> | genppd at run-time (and the list of printers changes as new ones are
> | added).
> | 
> | Is using debconf possible in this case?  Preconfiguring will fail, as
> | I can't get the data to list at that point.  The "multiselect" widget
> | type is just what I'm looking for, though.
> 
> db_subst in the postinst, or make it possible to run it after the
> package has been installed?

Do you mean like in the following script?  I ran this once (as root)
but I only saw the first (note) question.  The other two were not
asked (according to the debconf DB, they were seen, and when I deleted
those entries still nothing happened).  The DB correctly shows the
defaults...

I'm not sure why this is going wrong since the templates *do* exist,
and it does use the correct template file:

# ./config configure 4.3.4
debconf (developer): frontend started
debconf (developer): Trying to find a templates file..
debconf (developer): Trying ./config.templates
debconf (developer): Trying ./templates
debconf (developer): I guess it is ./templates
debconf (developer): frontend running, package name is 
debconf (developer): starting ./config configure 4.3.4
Display message
debconf (developer): <-- INPUT medium cupsys-driver-gimpprint/autogen_ppd_tell
debconf (developer): --> 10 "cupsys-driver-gimpprint/autogen_ppd_tell" doesn't exist
debconf (developer): <-- GO 
debconf (developer): --> 0 ok
Get languages:
C,da,de,el,en_GB,es,fr,nl,no,pl,pt,sk,sv
debconf (developer): <-- SUBST cupsys-driver-gimpprint/language_ask default C
debconf (developer): --> 10 cupsys-driver-gimpprint/language_ask doesn't exist


Also, since the config script is passed the same parameters in both
the preconfigure and postinst cases, is there an easy way to terminate
the script when preconfiguring (since the questions might be empty or
outdated if the dependencies weren't met)??


Thanks for your help,
Roger

----config----
#!/bin/sh -e

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

echo "Display message"
# Display message about what the questions are about
db_input medium cupsys-driver-gimpprint/autogen_ppd_tell || true
db_go || true

echo "Get languages:"
languages=`echo C,\`cups-genppd -L\` | sed -e 's/ /,/g'`
echo $languages
#db_fset cupsys-driver-gimpprint/language_ask seen false
db_subst cupsys-driver-gimpprint/language_ask default "C"
db_subst cupsys-driver-gimpprint/language_ask choices $languages
db_input medium cupsys-driver-gimpprint/language_ask || true
db_go || true

echo "Get drivers"
drivers=`echo \`cups-genppd -M\` | sed -e 's/ /,/g'`
echo $drivers
#db_fset cupsys-driver-gimpprint/driver_ask seen false
db_subst cupsys-driver-gimpprint/driver_ask default $drivers
db_subst cupsys-driver-gimpprint/driver_ask choices $drivers
db_input cupsys-driver-gimpprint/driver_ask || true
db_go || true
----end config

----templates----
Template: cupsys-driver-gimpprint/autogen_ppd_tell
Type: note
Description: Generation of PPD files
 This package uses PostScript Printer Description files to allow
 CUPS to use the GIMP-Print printer driver library for
 high-quality printing.
 .
 Previously, the package included over a hundred PPD files, but
 this approach was not flexible enough.  Most users use only
 one or two PPD files, and the rest take up a lot of disk space.
 In addition, PPD files can be localised to use your native
 language.  Previously, the PPD files were in US English only.
 .
 The package will now ask you which languages you would like
 the PPD files to use, and which printers you wish to
 generate PPDs for.

Template: cupsys-driver-gimpprint/language_ask
Type: multiselect
Default: C
Description: Which languages would you like to use?
 You should choose at least one language.  The PPD files which
 are to be generated will use each of the languages that you
 choose.  A separate PPD file will be written (per printer)
 for each language.

Template: cupsys-driver-gimpprint/driver_ask
Type: multiselect
Default: set-in-config
Descriptions: Which printer models would you like to use?
 Choose which models of printer that you have.  For each model,
 one PPD file will be created for each language that you have chosen.
----end templates----

-- 
Roger Leigh
                ** Registration Number: 151826, http://counter.li.org **
                Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848 available on public keyservers



Reply to: