Fix groot and grub handling
authorMichael Prokop <devnull@localhost>
Wed, 27 Aug 2008 00:25:21 +0000 (02:25 +0200)
committerMichael Prokop <devnull@localhost>
Wed, 27 Aug 2008 00:25:21 +0000 (02:25 +0200)
grml-debootstrap

index 221f8d3..ac188e1 100755 (executable)
@@ -149,6 +149,14 @@ while [ "$#" -gt "0" ] ; do
 done
 # }}}
 
 done
 # }}}
 
+# welcome screen {{{
+welcome_dialog()
+{
+   dialog --title "$PN" --msgbox "Welcome to the interactive configuration of grml-debootstrap." 0 0
+   # TODO: improve message
+}
+# }}}
+
 # ask for target {{{
 prompt_for_target()
 {
 # ask for target {{{
 prompt_for_target()
 {
@@ -199,7 +207,6 @@ prompt_for_bootmanager()
 
   case "$GETMBR" in
     mbr)
 
   case "$GETMBR" in
     mbr)
-      USE_MBR=1
       # /dev/md0: has to be installed in MBR of /dev/md0 and not in /dev/md:
       if echo $TARGET | grep -q "*md*" ; then
          BOOT_PARTITION="${TARGET}"
       # /dev/md0: has to be installed in MBR of /dev/md0 and not in /dev/md:
       if echo $TARGET | grep -q "*md*" ; then
          BOOT_PARTITION="${TARGET}"
@@ -211,11 +218,9 @@ prompt_for_bootmanager()
       BOOT_PARTITION="$TARGET"
       ;;
     hda)
       BOOT_PARTITION="$TARGET"
       ;;
     hda)
-      USE_MBR=1
       BOOT_PARTITION="/dev/hda"
       ;;
     sda)
       BOOT_PARTITION="/dev/hda"
       ;;
     sda)
-      USE_MBR=1
       BOOT_PARTITION="/dev/sda"
       ;;
     nowhere)
       BOOT_PARTITION="/dev/sda"
       ;;
     nowhere)
@@ -250,7 +255,7 @@ grubdevice() {
      echo 'quit' | grub --device-map="$device_map" 1>/dev/null 2>&1
   fi
 
      echo 'quit' | grub --device-map="$device_map" 1>/dev/null 2>&1
   fi
 
-  # taken from d-i's trunk/packages/arch/i386/grub-installer/grub-installer:
+  # based on code from d-i's trunk/packages/arch/i386/grub-installer/grub-installer:
   tmp_disk=`echo "$device" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
                     -e 's%\(fd[0-9]*\)$%\1%' \
                     -e 's%/part[0-9]*$%/disc%' \
   tmp_disk=`echo "$device" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
                     -e 's%\(fd[0-9]*\)$%\1%' \
                     -e 's%/part[0-9]*$%/disc%' \
@@ -267,12 +272,7 @@ grubdevice() {
         echo "$tmp_drive"
         ;;
       *) # we expect something like 'hd0,0'
         echo "$tmp_drive"
         ;;
       *) # we expect something like 'hd0,0'
-        # make sure we don't install into MBR if $USE_MBR is not set
-        if [ -z "$USE_MBR" ] ; then
-           echo "$tmp_drive" | sed "s%$%,`expr $tmp_part - 1`%"
-        else
-           echo "$tmp_drive" | sed "s%,[0-9]%%"
-        fi
+        echo "$tmp_drive" | sed "s%$%,`expr $tmp_part - 1`%"
         ;;
   esac
 }
         ;;
   esac
 }
@@ -281,6 +281,7 @@ grubdevice() {
 # interactive mode {{{
 interactive_mode()
 {
 # interactive mode {{{
 interactive_mode()
 {
+  welcome_dialog
   prompt_for_target
   prompt_for_bootmanager
   prompt_for_mirror
   prompt_for_target
   prompt_for_bootmanager
   prompt_for_mirror
@@ -288,13 +289,6 @@ interactive_mode()
   [ -n "$BOOT_PARTITION" ] && GRUB="$(grubdevice $BOOT_PARTITION)"
   [ -n "$TARGET" ]         && GROOT="$(grubdevice $TARGET)"
 
   [ -n "$BOOT_PARTITION" ] && GRUB="$(grubdevice $BOOT_PARTITION)"
   [ -n "$TARGET" ]         && GROOT="$(grubdevice $TARGET)"
 
-  # FIXME
-  echo "debug: BOOT_PARTITION=$BOOT_PARTITION"
-  echo "debug: TARGET=$TARGET"
-  echo "debug: MIRROR=$MIRROR"
-  echo "debug: GROOT=$GROOT"
-  echo "debug: GRUB=$GRUB"
-
   # TODO
   # ask for raid
   # ask for lvm
   # TODO
   # ask for raid
   # ask for lvm