2009-11-10 Going old-school today: I wrote a sed sc ... 9 years ago
Going old-school today: I wrote a sed script to massage grub.conf to add a windows partition on a second disk. Searching google for has this been done before yields loads of page with handholding on how to add windows by hand to a grub.conf generated by anaconda but no simple 'automated' solution. I am always in favor of letting the computer do the boring work. But a bit of thinking and testing and now sed does the job:if [ -b /dev/sdb1 ]; then cp /boot/grub/grub.conf /boot/grub/grub.conf.pre sed -e 's/timeout=5/timeout=30/' -e '/hiddenmenu/a\ title Windows XP (Service Pack 3)\ rootnoverify (hd1,0)\ map (hd0) (hd1)\ map (hd1) (hd0)\ makeactive\ chainloader (hd1,0)+1 ' -e '/hiddenmenu/d' < /boot/grub/grub.conf.pre > /boot/grub/grub.conf fiEverybody knows sed -e 's/../../' but I had to look up 'insert', 'append' and 'delete'.
Update 2009-11-12: Changed insert to append because the previous version inserted windows multiple times with multiple linux kernels. Once is enough. Also moved it from the post-install instructions to the post-reboot script so linux is fully configured before windows gets booted.