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

Re: dashslashdash d-i patches



I'm going to cc -boot on this. This is an except of a diff of Phil's
dashslashdash d-i patches.

Philip Hands wrote:
> Index: packages/kbd-chooser/debian/kbd-chooser.isinstallable
> ===================================================================
> --- packages/kbd-chooser/debian/kbd-chooser.isinstallable	(.../trunk)	(revision 0)
> +++ packages/kbd-chooser/debian/kbd-chooser.isinstallable	(.../people/philh/etch)	(revision 35809)
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +. /usr/share/debconf/confmodule
> +db_get dsd/awaiting_preseed && [ "$RET" = true ] && exit 1
> +exit 0
> 
> Index: packages/kbd-chooser/debian/changelog
> ===================================================================
> --- packages/kbd-chooser/debian/changelog	(.../trunk)	(revision 35809)
> +++ packages/kbd-chooser/debian/changelog	(.../people/philh/etch)	(revision 35809)
> @@ -1,3 +1,10 @@
> +kbd-chooser (1.25-0.hands.1) UNRELEASED; urgency=low
> +
> +  * add an isinstallable script to allow this to be delayed for 
> +    preseeding
> +
> + -- Philip Hands <phil@deasil.hands.com>  Tue, 21 Mar 2006 22:24:38 +0000
> +
>  kbd-chooser (1.25) UNRELEASED; urgency=low

> Index: packages/localechooser/debian/changelog
> ===================================================================
> --- packages/localechooser/debian/changelog	(.../trunk)	(revision 35809)
> +++ packages/localechooser/debian/changelog	(.../people/philh/etch)	(revision 35809)
> @@ -1,3 +1,9 @@
> +localechooser (1.06-0.hands.1) UNRELEASED; urgency=low
> +
> +  * add localchooser/delaypostinst to enable preseeding this
> +
> + -- Philip Hands <phil@hands.com>  Tue, 21 Mar 2006 20:58:19 +0000
> +
>  localechooser (1.06) UNRELEASED; urgency=low
>  
>    * Add "../countrylist" in debian/po/POTFILES.in to make the region
> Index: packages/localechooser/debian/localechooser.isinstallable
> ===================================================================
> --- packages/localechooser/debian/localechooser.isinstallable	(.../trunk)	(revision 0)
> +++ packages/localechooser/debian/localechooser.isinstallable	(.../people/philh/etch)	(revision 35809)
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +. /usr/share/debconf/confmodule
> +db_get dsd/awaiting_preseed && [ "$RET" = true ] && exit 1
> +exit 0
> 
> %%% Well, as mentioned in the changelogs, I've added isinstallable scripts
> %%% to allow me to optionally delay these.  I've got an extra package, with
> %%% Installer-Menu-Item: 22 called dsd-chooser-stub, that depends on these
> %%% two, with an isinstalable that does the inverse, so that it only gets
> %%% installed if these two were already delayed.  I could probably just
> %%% go ahead and install that one, since it doesn't actually do anything,
> %%% but I'm trying to not change anything I don't need to

This strikes me as a cheap way to get netcfg and preseeding to run
early. I know that Kamion has done some work on making network config
and preseeding happen before main-menu, but now I'm wondering if
delaying locale and kbd selection like this isn't better.

IIRC main-menu currently does not skip back to menu items that are
before the last-executed item and have not been done yet, which is why
you need the dsd-chooser-stub. The same effect could be obtained by just
making sure that some other existing udeb on the menu depends on them.
It might even work to have prebaseconfig depend on both.

Of course this leaves both ethdetect and netcfg as things that can still
ask questions before preseeding. Or in the case of CDs, cdrom-config.

> %%% Ok, here's the heart of the matter.
> %%% First we have a new URL (this, I can imagine yo finding somewhat
> %%% upsetting ;-)
> %%% The idea is that if you specify an include file with a URL like:
> %%%    dsd://foo/bar
> %%% It will atempt to get it from
> %%%    http://debian-dsd-preseed.$domain/d-i/foo/bar
> %%% ($domain being the value of netcfg/get_domain)
> %%% failing that (i.e. there is no such server set up) it will get it from:
> %%%    http://svn.hands.com/d-i/foo/bar
> %%% having tried this once, it will remember which succeeded, and stick with it
> %%% Obviously, on official CDs, that svn.hands.com name should be set
> %%% to an appropriate debian.org host.

Ok, seems clearly not suitable for general d-i to me.

> %%% The other thing I've got here is that there are a couple of flags
> %%% that can be specified on preseed_fetch URLs
> %%%   If you put a ? on the end of the URL, it makes the mentioned file
> %%%   Optional (i.e. failing to download is no longer an error)
> %%%   A | on the end of the URL (perhaps followed by a ?) means that the
> %%%   preseed file should be executed, and the STDOUT used as the preseed
> %%%   file

> Index: packages/preseed/preseed.sh
> ===================================================================
> --- packages/preseed/preseed.sh	(.../trunk)	(revision 35809)
> +++ packages/preseed/preseed.sh	(.../people/philh/etch)	(revision 35809)
> @@ -15,6 +15,73 @@
>  	exit 1
>  }
>  
> +sans_flags() {
> +  expr "$1" : '\(.*[^|?]\)|*?*$'
> +}
> +is_optional() {
> +  expr "$1" : '.*[^|?]|*?$' > /dev/null
> +}
> +is_substitution() {
> +  expr "$1" : '.*[^|?]|?*$' > /dev/null
> +}

>  	local tmp=/tmp/debconf-seed
>  	
> -	if ! preseed_fetch $location $tmp; then
> -		error retrieve_error "$location"
> +	if ! dsd_preseed_fetch $(sans_flags $location) $tmp; then
> +		if is_optional $location ; then
> +			# if the file's optional, make the preseed empty
> +			> $tmp
> +		else
> +			error retrieve_error "$location"
> +		fi
>  	fi
>  	if [ -n "$checksum" ] && \
>  	   [ "$(md5sum $tmp | cut -d' ' -f1)" != "$checksum" ]; then
>  		error retrieve_error "$location"
>  	fi
>  
> +	if is_substitution $location; then
> +		mv $tmp $tmp.subst
> +		chmod +x $tmp.subst
> +		echo "# --- Output from executing: $location" > $tmp
> +		if ! $tmp.subst >> $tmp 2> $tmp.stderr ; then
> +			error substitution_error "$location"
> +		fi
> +		mv $tmp.stderr /var/log/$(echo "$location"|tr '/|' '_').stderr
> +	fi
> +
>  	db_set preseed/include ""
>  	db_set preseed/include_command ""
>  	UNSEEN=

So, optional files: 

 - Don't like the "?" and the end of an url since a valid url might
   possibly have a good reason for ending with a literal "?".
 - It seems to me that it cause issues with network robustness, having
   a file get skipped if the network happens to glitch and it's marked
   optional doesn't appeal.

Executed files:

 - Slightly in favour of adding this feature, although I expect it will
   be used rarely, and I'd really rather see people making udebs when
   they need to customise the installer to the extent this can afford.

   I'm not sure about having the output of the file be a preseed file.
   Why is it better to have a script that does this:

   echo "d-i foo/bar string baz"

   Rather than:

   debconf_set foo/bar "baz"

   Doing the latter would make it easier for users to start out perhaps
   as one of these scripts, and eventually package it up into a udeb
   without having to rewrite it all.

   Of course if this is done as just a script that gets downloaded and
   executed, there's already a way to do that in preseeding:

   d-i preseed/early_command string wget http://url/script.sh ; sh script.sh

   But this has the issues of needing to have the url hardcoded instead
   of fetching from wherever the preseed file came from, and of having
   fairly crap error handling. We could do something like this to get
   the best of both worlds:

   d-i preseed/run_script string script.sh

   Which would be run as soon as the preseed file containing it was
   loaded.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: