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

Re: auto-installing debian on xen on debian with debian-installer preseeding



John Smith wrote:
> On Wed, 29 Jun 2005 13:06:58 +0100
> Philip Hands <phil@hands.com> wrote:
> 
> 
>>Hi Folks,
>>
>>Hopefully this will be of interest to some of you.
>>
>>I've put together a debian-installer preseed setup, that allows (among
>>other things) one to do a non-interactive install of Xen with a minimal
>>Debian as it's Domain0, sets up LVM so that one can create disks for other
> 
> 
>>Cheers, Phil.
>>
> 
> 
> Good work, Phil.
> 
> JoeyH, can you put his changes in d-i?

Most of my stuff is unlikely to be directly insertable into d-i, since much
of the effort is about working round the lack of features in sarge's d-i,
some of which have already been addressed since.

On the other hand, the bits that have resulted in particularly twisted work
arounds might suggest features to make such things easier.

For example, I've used a few preseed variables of my own creation
(local/cfg local/site local/type ...) with local/cfg taking a semicolon
separated list that gets chopped up into the other variables, so that one
can set a bunch of stuff and only use one parameter on the kernel command
line, and the minimal number of characters.

In the top level preseed.cfg, preseed/url may not yet exist, so if I write
something that sets it with debconf-set, it silently fails because
debconf-set only sets existing variables, so I ended up doing this (which
gets the third bit of local/cfg and stuffs it into preseed/url (with
"/preseed2.cfg" appended):

  d-i     preseed/include_command string ( set -x; url="$(debconf-get
local/cfg|cut -sd';' -f3)" ; [ -z "$url" ] && url="http://hands.com/d-i"; ;
 if [ -n "$(debconf-get preseed/url)" ] ; then echo preseed2.cfg ; else
echo "x preseed/url x $url/preseed2.cfg" > /tmp/preseed-url.set;
debconf-set-selections /tmp/preseed-url.set; fi ) 2>
/var/log/preseed-1_include_command.debug

which (in case that's making your eyes bleed) implements the following rules:

  If preseed/url is set, assume that someone set it on the command line,
  and that they specified this file, so chain onto preseed2.cfg by echoing
  that.

  If not, then this file got loaded with either the /preseed.cfg trick, or
  preseed/file, so we can set preseed/url and it will get loaded.  In that
  case, check if there's anything after the second ; in the local/cfg file,
  if so, set $url to that, otherwise set $url to the default
  http://hands.com/d-i, then create & set preseed/url to $url/preseed2.cfg

OK, so that's probably a horrendous abuse of the include_command stuff, but
it allows one to make a generic install CD (for example) and tell it that
you want to install a "dnsserver" machine, using the mirrored
preseeds&scripts hosted on a local machine, thus:

  boot:  auto26 local/cfg=dnsserver;;http://intranet.example.com/d-i

I couldn't work out another way of making that work without having to make
new CDs every time I added a site, and I wanted my stuff to work for people
I've never heard of.

This would be a lot easier to do if there was a way of specifying the
setting of variables to the output of commands, something like (/me gets a
sinking feeling thinking "I bet someone's going to say it's already a
feature" ;-):

  d-i preseed/include_command     exec echo "string $(debconf-get \
       local/di-url)/preseed2.cfg

(that's supposed to be 1 line)

with the output of the echo being substituted in for everything on the line
from the exec onwards.

Of course, execution order needs to be thought about in case someone tries
doing something like:

  d-i local/netcfg_hostname exec echo string $(debconf-get \
       netcfg/get_hostname)

  d-i netcfg/get_hostname exec echo string $(debconf-get \
       local/hostname)

Another thing that I'm currently having to modify the initrd to address is
the fact that setting ones keyboard on the kernel command line takes 3
parameters and loads of characters.  In combination with the ability to
have programmable settings for variables, it ought to be possible to have a
multi field command line setting (I seem to remember seeing someone suggest
 using */foo, so lets say */* for the moment, where the first few fields
might be the location, and keymaps, and the next couple be the network
stuff, so that all the pre-network questions could be set in one go:

  */*=GB;uk;English;-;-

(with the - & - being short for unassigned-hostname & unassigned-domain)

with a preseed containing enough smarts to work out the default keyboard
from the country one is in, that could then be:

  */*=GB;;;-;-

if we add a field for the preseed/url we can set pretty much everything
needed before the network comes up (ok, so we need a way of setting static
IP addresses, but that's just a few more fields) and we end up with the
ability to use the same initrd, and only ever have to change the
???linux.cfg, or do a bit of typing at the boot: prompt.

I'm thinking of something like:

  boot:  linux */*=GB;;;-;-;;;http://hands.com/d-i/preseed2.cfg

with the presence of the */* parameter indicating that an otherwise ignored
preseed.cfg on the boot media should be used.

Hmm, that's probably enough of that for the moment :-)

Cheers, Phil.

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: