Hey list,
I'm having an issue with my myfoo-server maintainer scripts for my
package myfoo-server. In a nutshell, I am trying to get the user's
requested configuration to be handled elegantly.
I've read the debconf specification and debconf-devel(7). I see that my
issue is discussed:
https://manpages.debian.org/jessie/debconf-doc/debconf-devel.7.en.html#HACKS
If the user installs the myfoo-server package they will be prompted by
debconf in myfoo-server.config to select whether to enable zeroconf,
upnp, etc. and various other settings for the server. Those selected
settings, whatever their values, should then be written out during the subsequent run of myfoo-server.postinst to /etc/myfoo/server.conf.
If myfoo-server.config detects that the user already had an /etc/myfoo/server.conf, such as when they are re-installing the
package, myfoo-server.conf should read those values in-place from disk
and then seed debconf via my SeedFromUserConfiguration POSIX shell
function before any prompts might be displayed (depends on priority, of course).
That is what I had intended. I think this behaviour is reasonable.
So I start by installing the myfoo-server package locally, e.g.
$ sudo apt install ./myfoo-server(...).deb
...
Preconfiguring packages ...
...
I then see debconf prompts, as expected, from within my myfoo-
server.config. I select true to enable upnp and zeroconf (false and
true by default in their templates respectively).
For the sake of debugging, I checked the myfoo-server/zeroconf debconf
field as you see on myfoo-server.config:192 after it is read back from
debconf and it is indeed whatever value the user had set it to when
prompted (and same for all other settings).
Great. That much works as expected.
But after that session of myfoo-server.config is run, it appears to be
run _again_ after the package is unpacked, but _before_ myfoo-
server.postinst is run:
...
Setting up myfoo-server (...)
...
The problem here is this re-running of the myfoo-server.config happens
before the myfoo-server.postinst. This is bad because the latter is
supposed to update the values in /etc/myfoo/server.conf to whatever the
user just entered via debconf prompts.
Because myfoo-server.config's second invocation sees the newly unpacked /etc/myfoo/server.conf, it unintentionally seeds debconf with the
values contained therein.
The myfoo-server.postinst script is then run, writing out to /etc/myfoo/server.conf the clobbered debconf values.
What am I doing wrong and what do you recommend?
These are my myfoo-server.config and myfoo-server.postinst:
https://pastebin.com/hyWyH5id
https://pastebin.com/xW1andmW
--
Kip Warner -- Senior Software Engineer
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEaUi0dj/qpTzsKe4xRLRlxF7U4wQFAmGgXTcACgkQRLRlxF7U 4wQxWRAAgeTZWhFJEtdXv7JVSWkGcFVPjJukg1kpepTh1A9HzIFOYRaXkcopU/OG PYEk/JKr3wZORQFFBTA/EcU9qGIYfrGdgor5iXtXC/yFaBMH2MSrgFF3B5WM4606 55MVpYCPssEjQEprg3rfmIFtDV4mMp33201g/Zyi3MxcfE1QJf0ptCTsGd5E4ovK V/zHuXFMoEsVpbuyjkbe3eIlJ5UGlBhgRsqx3pda7Ap5E9iuSkacNCsmu46EURwO 55gjgkPDk4u+XTsEL/Eq6UaMxFxY62G8ztVPvUMe/K3BdEWe483nicgIAs08Nntj gUqUt/YpNjYZOwSavvw+pg0J3aAHQ7s4APp25ckZ0yVyKlxomm7OIw7BWiGd2PKi pmnklsAtMmoo1O0Q/afQNUXGXxhaLVWjxyKcGyJbm1N3xAVEawmVubdpX1dPKztC sYlPzR5qSp+hMaG6xGSyZmXYmLlrUt15/DmEsPr1rJMIbRGjp+v9xZgZ55VB19sg 6I009+zbnqlqjGC7/v6GvqfMW0M9erS4eC3nJYkOS4mPALAhkuhiNyl05cPxoMQ1 Iui4ltUTyP4LMT/aKY6Fc9L6nMVzpbkrgiz4DOaN8U3RkFOg0zrnXKSxtUL8g3Ko 0pq9phX56VqDWXRsdM+aXB36MgS6q9TzX9lkWKVbUkvQaUrDwWc=
=wFL0
-----END PGP SIGNATURE-----
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gatew