Hello, I started on experimenting on how to enhance the debconf protocol with respect to sophisticated frontends (in this case the gtk frontend). Although in the preceding discussion most people liked the idea of some kind of intermediate widget describing language, I dismissed the idea, because I considered it too complex. Perhaps someone else wants to pursue this path. I followed an idea of Tollef to have custom widgets which are frontend specific. They are loaded on the fly as shared objects and cdebconf will return a specific receipt if the custom widget has no implementation for the selected frontend. In detail: I introduced a new question type "custom". In templates one can and in fact should add a line "Implemets: $other_questions" where $other_questions is a list of questions which shall be answered by the custom widget. The custom widget's code has to set the answers to these question according to what the user has entered. A custom widget is implemented by a shared object which has a name and position dependant on its name in the template. E.g. a gtk widget for a question "test/ip_address" will be located (relative to the frontend module path): custom/test/ip_address_gtk.so The shared object must have a handler function called test_ip_address_gtk, where the arguments and the return type can be defined by the frontend. I prepared a sample implementation (which is experimental and surly has some bugs) and instructions how to test it. Find that at the end of the mail. Please give me some comments on the design. Regards, Sebastian INSTRUCTIONS: 1) Get the cvs version of cdebconf: $cvs -d :pserver:anonymous@cvs.debian.org:/cvs/debian-boot co \ debian-installer/tools/cdebconf 2) Apply the following patch: http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/cdebconf_custom.diff 3) Build cdebconf (according to instructions in doc/testing.txt): ./configure --with-frontend=gtk --with-conffile=./cdebconf.conf 4) Create a config file for cdebconf or grab this one: http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/cdebconf.conf Put it into src/test 5) Grab the following template file and script and put them into src/test: http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/custom.template http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/custom.config 6) Load the template file. Do this in src/test: $../debconf-loadtemplate debian 7) Execute the script with cdebconf: $../debconf custom.config -> The first question to be asked would be of custom type. Since there is no .so installed for the gtk frontend, cdebconf reports this to the script and the script asks a fallback question of type "string". 8) Put the custom widget below into src/modules/frontend/custom/test http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/ip_gtk.so Sources are here: http://www.mmweg.rwth-aachen.de/~sebastian.ley/d-i/test_ip.c It must be linked against gtk.so in src/modules/frontend/gtk 9) Execute the test script again: $../debconf custom.config -> As you can see the normal string widget has now been replaced by an IP address widget. (Note: The widget is quite crappy. It does not show previously selected values, it is only for demonstration purposes). This is an example for a fairly simple widget. It is possible to create arbitaryly complex widgets with the current design, if the frontend does allow it. -- PGP-Key: http://www.mmweg.rwth-aachen.de/~sebastian.ley/public.key Fingerprint: A46A 753F AEDC 2C01 BE6E F6DB 97E0 3309 9FD6 E3E6
Attachment:
pgpM3SeBup8fs.pgp
Description: PGP signature