[Lunar-commits] r14783 - lunar-iso/trunk/lunar-install/sbin

Auke Kok sofar at lunar-linux.org
Tue May 17 10:33:40 UTC 2005


Author: sofar
Date: 2005-05-17 10:33:39 +0000 (Tue, 17 May 2005)
New Revision: 14783

Modified:
   lunar-iso/trunk/lunar-install/sbin/lunar-install
Log:
This code now uses the core functionality (removes duplicate code) to figure out the grub device nodes. This is very shaggy code that most likely will fail in anything other than only-ide or only-scsi situations. Perhaps later I will add a menu to support /boot /root or /mbr installations, which should be relatively easy from now.


Modified: lunar-iso/trunk/lunar-install/sbin/lunar-install
===================================================================
--- lunar-iso/trunk/lunar-install/sbin/lunar-install	2005-05-17 10:01:05 UTC (rev 14782)
+++ lunar-iso/trunk/lunar-install/sbin/lunar-install	2005-05-17 10:33:39 UTC (rev 14783)
@@ -395,6 +395,7 @@
 	    FORMAT=no
 	fi
 	MNT_OPTS=$(determine_mount_opts $FSYS) &&
+	MNT_PNT=${MNT_PNT%%/}
         FSCK_PASS=$(determine_fsck_pass $FSYS $MNTPNT) &&
 
         PARTITIONS=(${PARTITIONS[@]} "$PART:$MNTPNT:$FSYS:$MNT_OPTS:$FSCK_PASS:$CHECK:$FORCE:$FORMAT" )
@@ -403,6 +404,9 @@
         if [ "$MNTPNT" == "/" ]; then
             ROOT=$PART
         fi
+	if [ "$MNTPNT" == "/boot" ]; then
+	    BOOT=$PART
+	fi
     done
 }
 
@@ -464,27 +468,9 @@
 }
 
 
-map_to_grub() {
-    # TODO - make sure partitions count continuously
-    # TODO - check if ide, scsi, md is the correct order
-    for LINE in $(
-        for N in /dev/discs/disc*/* ; do
-            echo "$(readlink -f $N | sed -e 's/\/dev\/ide/0/g' \
-            -e 's/\/dev\/scsi/1/g' -e 's/\/dev\/md/2/g' | sort):$N"
-        done); do 
-        DEVICE=$(echo $LINE | cut -d: -f1)
-        TARGET=$(echo $LINE | cut -d: -f2)
-        if echo $DEVICE | grep -q "disc" ; then
-            (( DISC++ ))
-        fi
-        echo "hd$((DISC-1)),$(echo $DEVICE | sed -e 's/.*\///' -e 's/disc/0/' -e 's/part//'):$TARGET"
-    done | grep ":$1$" | cut -d: -f1
-}
-
-
 install_grub()
 {
-    GRUB_ROOT=$(map_to_grub /dev/discs/$ROOT)
+    GRUB_ROOT=$(lsh map_device_to_grub /dev/discs/$ROOT)
     GRUB_DISC=$(echo $GRUB_ROOT | cut -d, -f1)
     
     (
@@ -493,13 +479,24 @@
       echo "quit"
     ) | grub
 
-    echo "grub was installed on the MBR of $GRUB_DISC"
-    sleep 2
-
-    # filty trick to make kernel compiles work later on:
-    GRUB_ROOT="($GRUB_ROOT)"
-    GRUB_BOOT=/boot
+    # setup grub details
+    if [ "$BOOT" == "$ROOT" ]; then
+        GRUB_ROOT="($GRUB_ROOT)"
+    	GRUB_BOOT=/boot
+    else
+        GRUB_ROOT="($(lsh map_device_to_grub /dev/discs/$BOOT))"
+        GRUB_BOOT=""
+    fi
     export GRUB_ROOT GRUB_BOOT
+
+    echo ""
+    echo "grub should use the following parameters from now on:"
+    echo "  root   $GRUB_ROOT"
+    echo "  kernel $GRUB_BOOT/\${ image name }"
+    echo ""
+
+    echo "grub was installed on the MBR of $GRUB_DISC"
+    sleep 4
 }
 
 



More information about the Lunar-commits mailing list