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

initramfs generator selection (was: Re: r33348 - trunk/packages/base-installer/debian)



Right, this patch should get me to a lot of bonus points with Sven so 
he'll not jump on my back the next few times I tell him I don't agree 
with him.

It has been tested, but the implementation can probably be cleaned up a 
bit and maybe we should discuss the defaults to be used.
For now I've set both yaird and initramfs as options, which I think is 
best in the current situation where both tools still have issues in 
certain situations.

As hppa and sparc currently lack klibc and thus initramfs-tools, defaults 
for them have been set to yaird only [1].
In the long run this will allow for per arch defaults and option to allow 
the user to select a tool or not.

The question should be preseedable by setting a single tool for
   base-installer/kernel/linux/initramfs-generators
(no, _not_ the template that is actually shown).

Cheers,
FJP

[1] Note: base-installer/kernel/linux/initramfs-2.6 needs to be enabled 
for hppa first!


On Wednesday 28 December 2005 01:56, Frans Pop wrote:
> Author: fjp
> Date: Wed Dec 28 00:56:01 2005
> New Revision: 33348
>
> Modified:
>    trunk/packages/base-installer/debian/base-installer.templates
>    trunk/packages/base-installer/debian/changelog
>    trunk/packages/base-installer/debian/postinst
>    trunk/packages/base-installer/debian/templates-arch
> Log:
> Add support for different initramfs generators, allowing different
> defaults per architecture. If there are multiple values, allow the
> user to select one.
>
>
> Modified: trunk/packages/base-installer/debian/base-installer.templates
> =======================================================================
>======= ---
> trunk/packages/base-installer/debian/base-installer.templates	(original
>) +++ trunk/packages/base-installer/debian/base-installer.templates	Wed
> Dec 28 00:56:01 2005 @@ -60,6 +60,14 @@
>   .
>   Check /var/log/syslog or see virtual console 4 for the details.
>
> +Template: base-installer/initramfs/generator
> +Type: select
> +Choices: ${GENERATORS}
> +_Description: Tool to use to generate initramfs initrd:
> + The list shows the available tools. If you are unsure which to
> select, + you should select the default. If your system fails to
> reboot, you can + retry the installation using the other options.
> +
>  Template: base-installer/kernel/failed-install
>  Type: error
>  _Description: Unable to install the selected kernel
>
> Modified: trunk/packages/base-installer/debian/changelog
> =======================================================================
>======= --- trunk/packages/base-installer/debian/changelog	(original)
> +++ trunk/packages/base-installer/debian/changelog	Wed Dec 28 00:56:01
> 2005 @@ -1,3 +1,11 @@
> +base-installer (1.41) UNRELEASED; urgency=low
> +
> +  * Add support for different initramfs generators, allowing different
> +    defaults per architecture. If there are multiple values, allow the
> +    user to select one.
> +
> + -- Frans Pop <fjp@debian.org>  Wed, 28 Dec 2005 01:55:14 +0100
> +
>  base-installer (1.40) unstable; urgency=low
>
>    [ Frans Pop ]
>
> Modified: trunk/packages/base-installer/debian/postinst
> =======================================================================
>======= --- trunk/packages/base-installer/debian/postinst	(original)
> +++ trunk/packages/base-installer/debian/postinst	Wed Dec 28 00:56:01
> 2005 @@ -462,6 +462,22 @@
>  	echo "$biggest_partition"
>  }
>
> +select_initramfs_generator () {
> +	irf_choices="$(echo $1 | sed "s/ */, /g")"
> +	irf_default="${1%% *}"
> +	db_subst base-installer/initramfs/generator GENERATORS "$irf_choices"
> +	db_set base-installer/initramfs/generator "$irf_default"
> +
> +	db_input high base-installer/initramfs/generator || [ $? -eq 30 ]
> +	if ! db_go; then
> +		db_progress stop
> +		exit 10
> +	fi
> +
> +	db_get base-installer/initramfs/generator
> +	echo $RET
> +}
> +
>  install_kernel () {
>  	if [ "$KERNEL" = none ]; then
>  		info "Not installing any kernel"
> @@ -535,18 +551,36 @@
>  link_in_boot = $link_in_boot
>  EOF
>
> +	package=""
>  	if [ "$do_initramfs" = yes ]; then
> -		# TODO: This would be a good place for a question about
> -		# whether to use initramfs-tools or yaird, if desired. The
> -		# next block would need to take into account any differences
> -		# in configuration file syntax.
> -		package=initramfs-tools
> -		ramdiskconf=/target/etc/mkinitramfs/initramfs.conf
> +		if db_get base-installer/kernel/linux/initramfs-generators; then
> +			generators="$RET"
> +			info "Available initramfs generator(s) '$generators'"
> +			if echo "$generators" | grep -q " "; then
> +				package="$(select_initramfs_generator "$generators")"
> +			else
> +				package="$generators"
> +			fi
> +		fi
> +		if [ -z "$package" ]; then
> +			package=initramfs-tools
> +		fi
> +		case "$package" in
> +		    initramfs-tools)
> +			ramdiskconf=/target/etc/mkinitramfs/initramfs.conf
> +			;;
> +		    yaird)
> +			ramdiskconf=
> +			;;
> +		esac
>  	else
>  		package=initrd-tools
>  		ramdiskconf=/target/etc/mkinitrd/mkinitrd.conf
>  	fi
> +	echo "Selected initrd generator '$package'"
>
> +	# TODO This should probably be restructured to better support
> +	#      differences between initrd generators
>  	if [ yes = "$do_initrd" ] ; then
>  		info "Installing $package."
>
> @@ -595,7 +629,7 @@
>  		else
>  			resume=
>  		fi
> -		if [ "$resume" ]; then
> +		if [ -n "$ramdiskconf" -a "$resume" ]; then
>  			if [ -f $ramdiskconf ] ; then
>  				sed -e "s@^#* *RESUME=.*@RESUME=$resume@" < $ramdiskconf >
> $ramdiskconf.new && mv $ramdiskconf.new $ramdiskconf
>
> Modified: trunk/packages/base-installer/debian/templates-arch
> =======================================================================
>======= ---
> trunk/packages/base-installer/debian/templates-arch	(original) +++
> trunk/packages/base-installer/debian/templates-arch	Wed Dec 28 00:56:01
> 2005 @@ -50,6 +50,16 @@
>  # defaults if you want to select among different initramfs creation
> tools. Description: use an initramfs (linux 2.6 only)
>
> +Template: base-installer/kernel/linux/initramfs-generators
> +Type: string
> +Default: yaird initramfs-tools
> +Default[hppa]: yaird
> +Default[sparc]: yaird
> +# Space separated list of initrd generator packages to use. If you
> list more +# than one for an architecture, the user will be asked to
> select one. +# Note: if you add a new one, don't forget to support it
> in the postinst. +Description: package to use to generate initramfs
> +
>  Template: base-installer/kernel/linux/extra-packages
>  Type: string
>  Default:

Attachment: pgp2KILsTzrV2.pgp
Description: PGP signature


Reply to: