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

Bug#360281: initramfs-tools: Fix for "update-initramfs -k all -u|-c|-d" and manpage



tags 360281 patch
thanks

Package: initramfs-tools
Version: 0.75
Followup-For: Bug #360281

I saw few problems on update-initramfs command.  

   http://bugs.debian.org/360281
   http://bugs.debian.org/383600

The current update-initramfs impliment -k all only for -u option while
help message of the command gives wrong impression.

There is no mention of all in manpage.

Manpage does not document current Debian default behavior for -k version.

(I agree that update-initramfs does not to update for all kernels unless
 manually executed.  I had issues with 0.74 but I could boot system with
 older untouched kernel.  Conservative is good move.)

So here is my suggestion for fix.  I just moved "all" processing outside
of "update" while ensuring all additional options will be processed
properly and also added extra verbose line for the start of kernel version 
iteration to give better output.  Now "all" iteration properly preserve
all valid options :-) 

I hope this patch helps.

(I actually did not test this for -d.  Just tested for -c and -u. Also
I tested -v option too.)

(I kept FIXME line since this is part of moved lines.)

Osamu
-- Package-specific info:
-- /proc/cmdline
root=/dev/hda6 ro 

-- /proc/filesystems
	cramfs
	ext3

-- lsmod
Module                  Size  Used by
radeon                 98912  1 
drm                    61556  2 radeon
binfmt_misc            11016  1 
sonypi                 20668  0 
ppdev                   8516  0 
lp                     10852  0 
button                  6544  0 
ac                      4836  0 
battery                 9188  0 
ipv6                  222304  12 
dm_snapshot            15680  0 
dm_mirror              18768  0 
dm_mod                 49944  2 dm_snapshot,dm_mirror
sr_mod                 15876  0 
sbp2                   20648  0 
ide_generic             1376  0 [permanent]
sd_mod                 18592  0 
8250_pci               19840  0 
joydev                  8992  0 
hw_random               5624  0 
snd_intel8x0           30204  1 
pcmcia                 34012  0 
snd_intel8x0m          15980  0 
snd_ac97_codec         82720  2 snd_intel8x0,snd_intel8x0m
snd_ac97_bus            2368  1 snd_ac97_codec
shpchp                 34272  0 
pci_hotplug            27196  1 shpchp
firmware_class          9696  1 pcmcia
snd_pcm_oss            35968  0 
snd_mixer_oss          15872  1 snd_pcm_oss
snd_pcm                74532  4 snd_intel8x0,snd_intel8x0m,snd_ac97_codec,snd_pcm_oss
snd_timer              20836  1 snd_pcm
snd                    48100  9 snd_intel8x0,snd_intel8x0m,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
i2c_i801                8236  0 
i2c_core               19552  1 i2c_i801
intel_agp              21116  1 
agpgart                29864  2 drm,intel_agp
pcspkr                  3040  0 
yenta_socket           23884  2 
rsrc_nonstatic         11968  1 yenta_socket
pcmcia_core            37300  3 pcmcia,yenta_socket,rsrc_nonstatic
mousedev               10788  1 
tsdev                   7392  0 
8250_pnp                8704  0 
parport_pc             32132  1 
parport                33160  3 ppdev,lp,parport_pc
psmouse                34600  0 
rtc                    12340  0 
evdev                   9088  2 
eth1394                18052  0 
usb_storage            70560  0 
serio_raw               6596  0 
soundcore               9216  1 snd
snd_page_alloc          9512  3 snd_intel8x0,snd_intel8x0m,snd_pcm
scsi_mod              123080  4 sr_mod,sbp2,sd_mod,usb_storage
ext3                  118376  1 
jbd                    50292  1 ext3
mbcache                 8324  1 ext3
usbhid                 35520  0 
ide_cd                 35680  0 
cdrom                  32448  2 sr_mod,ide_cd
ide_disk               15072  3 
uhci_hcd               20424  0 
piix                    9476  0 [permanent]
generic                 4420  0 [permanent]
ide_core              111016  6 ide_generic,usb_storage,ide_cd,ide_disk,piix,generic
usbcore               111616  4 usb_storage,usbhid,uhci_hcd
e100                   31364  0 
ohci1394               30448  0 
ieee1394               86584  3 sbp2,eth1394,ohci1394
mii                     5312  1 e100
thermal                12904  0 
processor              25512  1 thermal
fan                     4516  0 


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages initramfs-tools depends on:
ii  busybox                       1:1.1.3-2  Tiny utilities for small and embed
ii  cpio                          2.6-17     GNU cpio -- a program to manage ar
ii  klibc-utils                   1.4.19-2   small statically-linked utilities 
ii  module-init-tools             3.2.2-3    tools for managing Linux kernel mo
ii  udev                          0.097-1    /dev/ and hotplug management daemo

initramfs-tools recommends no packages.

-- no debconf information

-- 
~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ +++++
        Osamu Aoki <osamu@debian.org>  Yokohama Japan, GPG-key: A8061F32
 .''`.  Debian Reference: post-installation user's guide for non-developers
 : :' : http://qref.sf.net and http://people.debian.org/~osamu
 `. `'  "Our Priorities are Our Users and Free Software" --- Social Contract

diff -Nru initramfs-tools-0.75/update-initramfs initramfs-tools-0.75.new/update-initramfs
--- initramfs-tools-0.75/update-initramfs	2006-08-18 22:38:08.000000000 +0900
+++ initramfs-tools-0.75.new/update-initramfs	2006-08-20 14:38:39.000000000 +0900
@@ -232,25 +232,6 @@
 		exit 0
 	fi
 
-	if [ "${version}" = "all" ]; then
-		: FIXME check for --yes, and if not ask are you sure
-		get_sorted_versions
-		if [ -z "${version_list}" ]; then
-			verbose "Nothing to do, exiting."
-			exit 0
-		fi
-		for u_version in ${version_list}; do
-			if [ "${verbose}" = "1" ]; then
-				vflag="-v"
-			fi
-			# Don't stop if one version doesn't work.
-			set +e
-			"${0}" -u -k "${u_version}" ${vflag}
-			set -e
-		done
-		exit 0
-	fi
-
 	set_initramfs
 
 	altered_check
@@ -345,6 +326,35 @@
 	usage "You must specify at least one of -c, -u, or -d."
 fi
 
+# Iterate for kernel versions if "-k all" is specified.
+
+if [ "${version}" = "all" ]; then
+	: FIXME check for --yes, and if not ask are you sure
+	get_sorted_versions
+	if [ -z "${version_list}" ]; then
+		verbose "Nothing to do, exiting."
+		exit 0
+	fi
+	OPTS="-b ${BOOTDIR}"
+	if [ "${verbose}" = "1" ]; then
+		OPTS="${OPTS} -v"
+	fi
+	if [ "${yes}" = "1" ]; then
+		OPTS="${OPTS} -y"
+	fi
+	if [ "${takeover}" = "1" ]; then
+		OPTS="${OPTS} -t"
+	fi
+	for u_version in ${version_list}; do
+		# Don't stop if one version doesn't work.
+		set +e
+		verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
+		"${0}" -${mode} -k "${u_version}" ${OPTS}
+		set -e
+	done
+	exit 0
+fi
+
 case "${mode}" in
 	c)
 		create
diff -Nru initramfs-tools-0.75/update-initramfs.8 initramfs-tools-0.75.new/update-initramfs.8
--- initramfs-tools-0.75/update-initramfs.8	2006-07-21 02:46:14.000000000 +0900
+++ initramfs-tools-0.75.new/update-initramfs.8	2006-08-20 13:34:11.000000000 +0900
@@ -30,19 +30,34 @@
 .TP
 \fB \-k \fI version
 Set the kernel version for whom the initramfs will be generated.
-For example the output of uname -r for your currently running kernel.
+The default will be the latest kernel version.
+
+The use of "all" for the 
+.I version
+string specifies 
+.B update\-initramfs 
+to execute 
+.B \-c
+,
+.B \-u
+and
+.B \-d 
+options for all installed kernel versions.
+
+(The kernel version of the currently running kernel is given by the 
+output of "uname -r" command.)
 
 .TP
 \fB \-c
-This mode creates a new initramfs.
+This mode creates a new initramfs for the specified kernel version(s).
 
 .TP
 \fB \-u
-This mode updates an existing initramfs.
+This mode updates the initramfs for the specified kernel version(s).
 
 .TP
 \fB \-d
-This mode removes an existing initramfs.
+This mode removes the initramfs for the specified kernel version(s).
 
 .TP
 \fB \-t

Reply to: