On Wed, 27 Jul 2011 04:12:44 +0000, The Fungi <fu...@yuggoth.org> wrote: > On Wed, Jul 27, 2011 at 10:41:07AM +0700, Ivan Shmakov wrote: > > AIUI, the .postinst scripts may be re-executed with > > dpkg-reconfigure(8). > [...] > > In fact, for years I've relied on precisely this behavior to > regenerate SSH host keys when cloning machines (virtual or > physical)... > > sudo rm /etc/ssh/*_key* && sudo dpkg-reconfigure openssh-server
For a while I've thought that it would be good to have a way of provoking such packages to reset themselves -- that way one might do something like: dpkg-reconfigure --set-state-to-pristine and that would then find packages that had things like keys to throw away, by running something like the postinst with perhaps a 'reset' option. If this was done in a flexible way, allowing behaviour to be modified via debconf questions, or similar, it should be able to handle the cases where you have a live CD, or have cloned a machine's disk, and want to change it's name and keys and mailname etc. It occurs to me that one might want to use this to allow someone to move a disk to a new machine without that resulting in your ethernet being renamed from eth0 to eth1 (but perhaps that's getting out of scope for this). Cheers, Phil. -- |)| Philip Hands [+44 (0)20 8530 9560] http://www.hands.com/ |-| HANDS.COM Ltd. http://www.uk.debian.org/ |(| 10 Onslow Gardens, South Woodford, London E18 1NE ENGLAND
pgpIlFfRvhh88.pgp
Description: PGP signature