Bug#264262: grub: update-grub for RAID devices

Stephan Helma Stephan Helma <s.p.helma@gmx.net>, 264262@bugs.debian.org
Sat, 07 Aug 2004 22:25:06 +0200


Package: grub
Version: 0.91-2
Severity: wishlist

Hi Robert,

I boot my Debian system from a RAID1 device. It would be nice if
update-grub could write more than one root devices (e.g.

# groot=(hd0,0) (hd1,0))

into menu.lst. So I have a backup for booting whenever the
first disk fails.

Attached is a patch to implement this feature. (The important part is
just the "for kroot in $groot ; do", "done" and using $kroot instead
of $groot. All other stuff is just differences in the number of
whitespaces.)

Cheers,
Stephan

-- System Information
Debian Release: 3.0
Kernel Version: Linux moritz 2.4.26 #8 Sun Jul 11 11:24:08 CEST 2004 i686 unknown

Versions of the packages grub depends on:
ii  libc6          2.2.5-6        GNU C Library: Shared libraries and Timezone
ii  libncurses5    5.2.20020112a- Shared libraries for terminal handling

-- Patch
*** /sbin/update-grub	Mon Feb  4 05:41:32 2002
--- /usr/local/stow/update-grub/sbin/update-grub	Sat Aug  7 15:38:25 2004
***************
*** 384,418 ****
  		fi
  	fi
  
! 	echo "title		Debian GNU/Linux, kernel $kernelVersion" >> $buffer
! 	echo "root		$groot" >> $buffer
! 	echo "kernel		$kernel $kopt"  >> $buffer
! 	if [ -n "$initrdName" ]; then
! 		echo "initrd		$initrd" >> $buffer
! 	fi
! 	echo "savedefault" >> $buffer
! 	echo >> $buffer
  
! 	# insert the alternative boot options
! 	if test ! x"$alternative" = x"false" ; then
! 		# for each altoptions line do this stuff
! 		sed -ne 's/# altoptions=\(.*\)/\1/p' $buffer | while read line; do
! 			descr=$(echo $line | sed -ne 's/\(([^)]*)\)[[:space:]]\(.*\)/\1/p')
! 			suffix=$(echo $line | sed -ne 's/\(([^)]*)\)[[:space:]]\(.*\)/\2/p')
! 			echo "title		Debian GNU/Linux, kernel $kernelVersion $descr" >> $buffer
! 			# lock the alternative options
! 			if test x"$lockalternative" = x"true" ; then
! 				echo "lock" >> $buffer
! 			fi
! 			echo "root		$groot" >> $buffer
! 			echo "kernel		$kernel $kopt $suffix"  >> $buffer
! 			if [ -n "$initrdName" ]; then
! 				echo "initrd		$initrd" >> $buffer
! 			fi
! 			echo "savedefault" >> $buffer
! 			echo >> $buffer
! 		done
! 	fi
  done
  
  echo $end >> $buffer
--- 384,420 ----
  		fi
  	fi
  
! 	for kroot in $groot ; do
! 		echo "title		Debian GNU/Linux, kernel $kernelVersion, boot from $kroot" >> $buffer
! 		echo "root		$kroot" >> $buffer
! 		echo "kernel		$kernel $kopt"  >> $buffer
! 		if [ -n "$initrdName" ]; then
! 			echo "initrd		$initrd" >> $buffer
! 		fi
! 		echo "savedefault" >> $buffer
! 		echo >> $buffer
  
! 		# insert the alternative boot options
! 		if test ! x"$alternative" = x"false" ; then
! 			# for each altoptions line do this stuff
! 			sed -ne 's/# altoptions=\(.*\)/\1/p' $buffer | while read line; do
! 				descr=$(echo $line | sed -ne 's/\(([^)]*)\)[[:space:]]\(.*\)/\1/p')
! 				suffix=$(echo $line | sed -ne 's/\(([^)]*)\)[[:space:]]\(.*\)/\2/p')
! 				echo "title		Debian GNU/Linux, kernel $kernelVersion $descr, boot from $kroot" >> $buffer
! 				# lock the alternative options
! 				if test x"$lockalternative" = x"true" ; then
! 					echo "lock" >> $buffer
! 				fi
! 				echo "root		$kroot" >> $buffer
! 				echo "kernel		$kernel $kopt $suffix"  >> $buffer
! 				if [ -n "$initrdName" ]; then
! 					echo "initrd		$initrd" >> $buffer
! 				fi
! 				echo "savedefault" >> $buffer
! 				echo >> $buffer
! 			done
! 		fi
! 	done
  done
  
  echo $end >> $buffer