i'm writing a patch script which including to append 'reboot=b' to grub kernel parameter to my linux box (many of them)
here's what i wrote;
Code:
#!/bin/bash
...
# append reboot=b to kernel parameter - 2007-02-26
kernel=`sed -n '/^kernel/p' /boot/grub/menu.lst | sed q` #get only the first kernel title
kernelappended="$kernel reboot=b"
if [ x$(echo $kernel | grep reboot=b) = "x" ]; then
#cp --parents /boot/grub/menu.lst $backupdir # ignore this line
sed "s/$kernel/$kernelappended" /boot/grub/menu.lst
fi
...
example;
the original: kernel /kernel-2.6.19-gentoo-r5 root=/dev/hda3 video=vesafb:ywrap,mtrr,800x600-16@60 splash=silent,fadein,theme:walpurgisnacht quiet CONSOLE=/dev/tty1
will become: the original: kernel /kernel-2.6.19-gentoo-r5 root=/dev/hda3 video=vesafb:ywrap,mtrr,800x600-16@60 splash=silent,fadein,theme:walpurgisnacht quiet CONSOLE=/dev/tty1 reboot=b
however the substitute sed command (sed "s/$kernel/$kernelappended" /boot/grub/menu.lst) failed..
please help me..
tq