Joey Hess wrote: > Phil, this is great stuff. I'd point you at my own preseed setup, but > you seem to have assimilated it.. Yes, thanks, the inspiration was very useful :-) That's a good point actually --- I ought to add a Credits/Thanks section to the README > Philip Hands wrote: > >> debian-installer: >> the current setup uses side effecting include-commands in a >> positively abusive manner to set preseed variables under scripted >> control --- there must be a better way (or we should add one) > > > I've mostly used the approach of putting such variables in separate > preseed files and limiting the script stuff to decided which file to > include. Maybe that doesn't meet your needs. I'm open to suggestions. > > >> I'd like to be able to say "include this preseed file if it exists, >> but don't give me an error if it doesn't" or alternatively "include >> this file if it exists, otherwise include that one" > > > d-i preseed/include_command string if [ -e file.cfg ]; then echo file.cfg; elif [ -e other.cfg ]; then echo other.cfg; else echo /dev/null; fi I've tried to write my setup so that it generally doesn't care if the files are sitting on an HTTP server, or have been copied onto, for example, a CD's /preseed/ directory. The above would work fine for the latter, but unless I'm missing something would do nothing if the files were sitting on a remote server. It did occur to me that I could wget the directory and grep it for the files, but then it will break if you then make the files available locally. > We could add some explicit support for this without the ugliness, if > you can come up with a way to write it in the file that makes sense. I was thinking that we could do something like add flags to the front, or end of the filename. If the only flag we can think of is "optional" then I'd be tempted to say that any filename starting with a question mark, will have the question mark stripped off, and if it is missing, would not cause an error. That way, one could do something like: d-i preseed/include_command string echo common.cfg; echo site/$(debconf-get local/site).cfg; echo ?site/$(debconf-get local/site)/type-$(debconf-get local/type).cfg If we wanted to make things more complicated, it might be nice to be able to say something like "if this file is available, load it, otherwise load this other one, perhaps with something like: ?site-foo/type-bar.cfg :site-foo/type-default.cfg but in most cases one could get away with: site-default.cfg site-foo/type-default.cfg ?site-foo/type-bar.cfg (assuming any of that makes any sense to anyone but me :-) > > >> It would be nice to have a script run late enough in the base-config >> so that one could reboot (in this case for the first boot into Xen) > > > base-config/late_command is run just before base-config exits, isn't > that late enough? Nope --- the thing that happens after that is the real inittab being moved into place, so a reboot in the late_command dumps you back into base-config. I've tried running "shutdown -r 2", "nohup shutdown -r 2 &" and even: perl -MPOSIX -e '$pid=fork;exit if $pid;POSIX::setsid();exec shift, \ @ARGV' sh -c "( sleep 120 ; reboot )" but the late_command seems unwilling to terminate with something in the background, and anyway, this approach is a messy hack, so I'd rather be able to do: base-config/final_command string reboot and have that executed at literally the last line of the base-config > BTW, I saw you have a udeb that wraps part of the install process. > What's the details of that? I wanted to be able to make use of base_excludes, but that only works on CD installs AFAICT, so that udeb moves run-debootstrap, and replaces it with a script that looks for /base_{in,ex}clude and if they exist, then adds --{in,ex}clude options to it's invocation of the original run-debootstrap. I use that to avoid installing exim (since my preference is for postfix) Cheers, Phil.
Attachment:
signature.asc
Description: OpenPGP digital signature