[d-i-commits] r32040 - trunk/packages/base-installer/debian

Colin Watson cjwatson at costa.debian.org
Mon Nov 14 16:22:51 UTC 2005


Author: cjwatson
Date: 2005-11-14 16:22:49 +0000 (Mon, 14 Nov 2005)
New Revision: 32040

Modified:
   trunk/packages/base-installer/debian/changelog
   trunk/packages/base-installer/debian/postinst
   trunk/packages/base-installer/debian/templates-arch
Log:
* Support configuring initramfs-tools rather than initrd-tools, and make
  that the default when installing 2.6. We still use initrd-tools on hppa
  and ia64, as the most current information I have indicates that
  initramfs-tools doesn't work there; porters should feel free to update
  this. I've left notes for where I think yaird could best be slotted in.

Modified: trunk/packages/base-installer/debian/changelog
===================================================================
--- trunk/packages/base-installer/debian/changelog	2005-11-14 15:49:18 UTC (rev 32039)
+++ trunk/packages/base-installer/debian/changelog	2005-11-14 16:22:49 UTC (rev 32040)
@@ -48,6 +48,11 @@
 
   [ Colin Watson ]
   * Fix code to avoid -smp variants on powerpc64.
+  * Support configuring initramfs-tools rather than initrd-tools, and make
+    that the default when installing 2.6. We still use initrd-tools on hppa
+    and ia64, as the most current information I have indicates that
+    initramfs-tools doesn't work there; porters should feel free to update
+    this. I've left notes for where I think yaird could best be slotted in.
 
  -- Sven Luther <luther at debian.org>  Mon, 14 Nov 2005 14:09:20 +0000
 

Modified: trunk/packages/base-installer/debian/postinst
===================================================================
--- trunk/packages/base-installer/debian/postinst	2005-11-14 15:49:18 UTC (rev 32039)
+++ trunk/packages/base-installer/debian/postinst	2005-11-14 16:22:49 UTC (rev 32040)
@@ -508,6 +508,19 @@
 		do_initrd=yes
 	fi
 
+	do_initramfs=no
+	if [ "$do_initrd" = yes ]; then
+		if db_get "base-installer/kernel/linux/initramfs-$target_kernel_major"; then
+			if [ "$RET" = true ]; then
+				do_initramfs=yes
+			fi
+		elif db_get base-installer/kernel/linux/initramfs; then
+			if [ "$RET" = true ]; then
+				do_initramfs=yes
+			fi
+		fi
+	fi
+
 	if db_get base-installer/kernel/linux/link_in_boot ; then
 		if [ "$RET" = "true" ]; then
 			link_in_boot=yes
@@ -536,28 +549,43 @@
 link_in_boot = $link_in_boot
 EOF
 
-	mkinitrdconf=/target/etc/mkinitrd/mkinitrd.conf
+	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
+	else
+		package=initrd-tools
+		ramdiskconf=/target/etc/mkinitrd/mkinitrd.conf
+	fi
+
 	if [ yes = "$do_initrd" ] ; then
-		info "Installing initrd-tools."
+		info "Installing $package."
 
-		# Make sure initrd-tools is installed before we change its
-		# configuration
-		db_subst base-installer/section/install_kernel_package SUBST0 "initrd-tools"
+		# Make sure the ramdisk creation tool is installed before we
+		# change its configuration
+		db_subst base-installer/section/install_kernel_package SUBST0 "$package"
 		db_progress INFO base-installer/section/install_kernel_package
-		if ! log-output -t base-installer apt-install initrd-tools; then
-			db_subst base-installer/kernel/failed-package-install PACKAGE initrd-tools
+		if ! log-output -t base-installer apt-install "$package"; then
+			db_subst base-installer/kernel/failed-package-install PACKAGE "$package"
 			exit_error base-installer/kernel/failed-package-install
 		fi
 
-		# Temporarily hardcode the root partition.
-		rootpart_devfs=$(mount | grep "on /target " | cut -d' ' -f1)
-		rootpartfs=$(mount | grep "on /target " | cut -d' ' -f5)
-		rootpart=$(mapdevfs $rootpart_devfs)
-		if [ -f $mkinitrdconf ]; then
-			sed -e "s#^ROOT=.*#ROOT='$rootpart $rootpartfs'#" < $mkinitrdconf > $mkinitrdconf.new &&
-				mv $mkinitrdconf.new $mkinitrdconf
-		else
-			echo "ROOT='$rootpart $rootpartfs'" >> $mkinitrdconf
+		if [ "$do_initramfs" = no ]; then
+			# Temporarily hardcode the root partition.
+			# This isn't needed with initramfs-tools (TODO:
+			# check yaird).
+			rootpart_devfs=$(mount | grep "on /target " | cut -d' ' -f1)
+			rootpartfs=$(mount | grep "on /target " | cut -d' ' -f5)
+			rootpart=$(mapdevfs $rootpart_devfs)
+			if [ -f $ramdiskconf ]; then
+				sed -e "s#^ROOT=.*#ROOT='$rootpart $rootpartfs'#" < $ramdiskconf > $ramdiskconf.new &&
+					mv $ramdiskconf.new $ramdiskconf
+			else
+				echo "ROOT='$rootpart $rootpartfs'" >> $ramdiskconf
+			fi
 		fi
 
 		# Set up a default resume partition.
@@ -568,15 +596,15 @@
 			resume=
 		fi
 		if [ "$resume" ]; then
-			if [ -f $mkinitrdconf ] ; then
-				sed -e "s@^#* *RESUME=.*@RESUME=$resume@" < $mkinitrdconf > $mkinitrdconf.new &&
-					mv $mkinitrdconf.new $mkinitrdconf
+			if [ -f $ramdiskconf ] ; then
+				sed -e "s@^#* *RESUME=.*@RESUME=$resume@" < $ramdiskconf > $ramdiskconf.new &&
+					mv $ramdiskconf.new $ramdiskconf
 			else
-				echo "RESUME=$resume" >> $mkinitrdconf
+				echo "RESUME=$resume" >> $ramdiskconf
 			fi
 		fi
 	else
-		info "Not installing initrd-tools."
+		info "Not installing $package."
 	fi
 
 	# Advance progress bar to 30% of allocated space for install_kernel
@@ -592,9 +620,9 @@
 	update_progress 90 100
 
 	# /proc/filesystems will accomodate this past the second bootup.
-	if [ "$do_initrd" = yes ]; then
-		sed -e 's/^ROOT=.*/ROOT=probe/' $mkinitrdconf > $mkinitrdconf.new &&
-			mv $mkinitrdconf.new $mkinitrdconf
+	if [ "$do_initrd" = yes ] && [ "$do_initramfs" = no ]; then
+		sed -e 's/^ROOT=.*/ROOT=probe/' $ramdiskconf > $ramdiskconf.new &&
+			mv $ramdiskconf.new $ramdiskconf
 	fi
 
 	if [ -f /target/etc/kernel-img.conf.$$ ]; then

Modified: trunk/packages/base-installer/debian/templates-arch
===================================================================
--- trunk/packages/base-installer/debian/templates-arch	2005-11-14 15:49:18 UTC (rev 32039)
+++ trunk/packages/base-installer/debian/templates-arch	2005-11-14 16:22:49 UTC (rev 32040)
@@ -39,6 +39,17 @@
 Default[sparc]: true
 Description: kernel needs an initrd (linux 2.6 only)
 
+Template: base-installer/kernel/linux/initramfs-2.6
+Type: boolean
+Default: true
+Default[hppa]: false
+Default[ia64]: false
+# This only indicates whether to use an initramfs or not (and will be
+# ignored unless the appropriate base-installer/kernel/linux/initrd* is
+# true). Create a separate question with its own architecture-specific
+# defaults if you want to select among different initramfs creation tools.
+Description: use an initramfs (linux 2.6 only)
+
 Template: base-installer/kernel/linux/link_in_boot
 Type: boolean
 Default: true




More information about the d-i-commits mailing list