On Sat, Oct 01, 2005 at 09:26:32PM +0200, houghi wrote:
> I am working on some butt ugly bash script myself. Still a pity that there
> is not a build in command to do it with.

OK. Here is the code I have made. Nit very good looking and too much grep
and awk instead of sed.

Also too many parameters. You run it as `bios /path/to/linux_kernel`
At this moment it only outputs the grub information. I will edit it so
that lilo will also work. I then will include it in makeSUSEdvd in such a
way that if you run makeSUSEdvd it will tell you what to fill out in both
grub and lilo config files. If anybody has an easier way, please let me
know.

Two examples:
[EMAIL PROTECTED] : bios /media/data/opensuse/DVD_10.1_A1/boot/loader/linux
### Put the following in /boot/grub/menu.lst ###
title SOMETHING
    root (hd3,2)
    linux /opensuse/DVD_10.1_A1/boot/loader/linux
    initrd /opensuse/DVD_10.1_A1/boot/loader/initrd

[EMAIL PROTECTED] : mount /dev/hdf6 /mnt/
[EMAIL PROTECTED] : bios /mnt/10.1/boot/loader/linux 
### Put the following in /boot/grub/menu.lst ###
title SOMETHING
    root (hd3,5)
    linux /10.1/boot/loader/linux
    initrd /10.1/boot/load


Here is the code I used:
#!/bin/bash
# bios
# Get the directory
DEV0=`dirname $1`
DEV=`df $DEV0 |grep dev|awk '{print $1}'`
# Get the prefix
PRE=`df $1 |grep dev|awk '{print $6}'`
AFT=`echo $DEV0|sed s#$PRE##g`
# Get the number
NUM=`echo $DEV|awk -F/dev/... '{f=$NF}END{print f+0}'`
# Get the boot sequence
DEV2=`echo $DEV|awk -F${NUM} '{print $1}'`
# Get it all together
let NUM=NUM-1
DEV3=`grep $DEV2 /boot/grub/device.map|awk -F")" '{print $1}'`",$NUM)"
#output
echo "### Put the following in /boot/grub/menu.lst ###"
echo "title SOMETHING"
echo "    root $DEV3"
echo "    linux $AFT/linux"
echo "    initrd $AFT/initrd"

houghi
-- 
Quote correct   (NL) http://www.briachons.org/art/quote/
Zitiere richtig (DE) http://www.afaik.de/usenet/faq/zitieren
Quote correctly (EN) http://www.netmeister.org/news/learn2quote.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to