---
 src/core/libs/lib-ui-interactive.sh |  253 +++++++++++++++++------------------
 1 files changed, 126 insertions(+), 127 deletions(-)

diff --git a/src/core/libs/lib-ui-interactive.sh 
b/src/core/libs/lib-ui-interactive.sh
index a2d5759..144749a 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -847,12 +847,12 @@ interactive_runtime_network() {
 
 interactive_install_bootloader () {
        ask_option Grub "Choose bootloader" "Which bootloader would you like to 
use?  Grub is the Arch default." required \
-                       "Grub" "Use the GRUB bootloader (default)" \
-                       "None" "\Zb\Z1Warning\Z0\ZB: you must install your own 
bootloader!" || return 1
+                                       "Grub" "Use the GRUB bootloader 
(default)" \
+                                       "None" "\Zb\Z1Warning\Z0\ZB: you must 
install your own bootloader!" || return 1
 
        bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"`
        [ "$bl" != grub ] && return 0
-    GRUB_OK=0
+       GRUB_OK=0
        interactive_grub
 }
 
@@ -860,140 +860,140 @@ interactive_grub() {
        get_grub_map
        [ ! -f $grubmenu ] && show_warning "No grub?" "Error: Couldn't find 
$grubmenu.  Is GRUB installed?" && return 1
 
-    debug FS "starting interactive_grub"
-    # try to auto-configure GRUB...
-    debug 'UI-INTERACTIVE' "install_grub \$PART_ROOT $PART_ROOT \$GRUB_OK 
$GRUB_OK"
+       debug FS "starting interactive_grub"
+       # try to auto-configure GRUB...
+       debug 'UI-INTERACTIVE' "install_grub \$PART_ROOT $PART_ROOT \$GRUB_OK 
$GRUB_OK"
        if get_device_with_mount '/' && [ "$GRUB_OK" != '1' ] ; then
                GRUB_OK=0
                PART_ROOT=$ANSWER_DEVICE
                # look for a separately-mounted /boot partition
-        # This could be used better, maybe we use a better variable name cause
-        # we use this later in many things in workflow.
-        # Currently we have bootdev as a device if we have a seperate /boot or 
empty
-        # if no seperate /boot. Where our /boot realy lives is important later
-        # to build the grub: root (hdx,y) part.
-        # So maybe we set a flag variable like: sepboot=true|false and set 
bootdev to either
-        # the partition with seperate /boot or to $PART_ROOT.
-        # So that bootdev is always our real partition with /boot....
-        bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1)
+               # This could be used better, maybe we use a better variable 
name cause
+               # we use this later in many things in workflow.
+               # Currently we have bootdev as a device if we have a seperate 
/boot or empty
+               # if no seperate /boot. Where our /boot realy lives is 
important later
+               # to build the grub: root (hdx,y) part.
+               # So maybe we set a flag variable like: sepboot=true|false and 
set bootdev to either
+               # the partition with seperate /boot or to $PART_ROOT.
+               # So that bootdev is always our real partition with /boot....
+               bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1)
                # check if bootdev or PART_ROOT is on a md raid array
-        # This dialog is only shown when we detect / or /boot on a raid device.
+               # This dialog is only shown when we detect / or /boot on a raid 
device.
                if device_is_raid $bootdev || device_is_raid $PART_ROOT; then
                        ask_yesno "Do you have your system installed on 
software raid?\nAnswer 'YES' to install grub to another hard disk." no
                        if [ $? -eq 0 ]; then
                                onraid=true
-                debug FS "onraid is selected"
+                               debug FS "onraid is selected"
                        fi
                fi
-        # Create and edit the grub menu.lst
-        interactive_bootloader_menu "GRUB" $grubmenu 
+               # Create and edit the grub menu.lst
+               interactive_bootloader_menu "GRUB" $grubmenu 
 
        DEVS="$(findblockdevices '_ ')"
-        if [ "$DEVS" = " " ]; then
-            notify "No hard drives were found"
-            return 1
-        fi
-        # copy initial grub files into installed system
-        cp -a $var_TARGET_DIR/usr/lib/grub/i386-pc/* $var_TARGET_DIR/boot/grub/
-        sync
-        # freeze xfs filesystems to enable grub installation on xfs filesystems
-        for xfsdev in $(blkid -t TYPE=xfs -o device); do
-            mnt=$(mount | grep $xfsdev | cut -d' ' -f 3)
-            if [ $mnt = "$var_TARGET_DIR/boot" -o $mnt = "$var_TARGET_DIR/" ]; 
then
-                /usr/sbin/xfs_freeze -f $mnt > /dev/null 2>&1
-            fi
-        done
-        
-        if [ ! $onraid ]; then
-            # Set boot partition to the device where our /boot lives.
-            [ -z $bootdev ] && bootpart=$PART_ROOT || bootpart=$bootdev
-            ask_option no "Boot device selection" "Select the boot device 
where the GRUB bootloader will be installed (usually the MBR and not a 
partition)." required $DEVS || return 1
-            bootdev=$ANSWER_OPTION
-            boothd=$(echo $bootdev | cut -c -8)
-            interactive_grub_install $bootpart $bootdev $boothd
-            if [ $? -eq 0 ]; then
-                GRUB_OK=1
-            fi
-        else
-            # Raid special
-            # The bootpart and bootdev should not be changed when setup grub 
on all raid array members.
-            # Instead the device is mapped via grub parameter device
-            # So a grub setup on MBR sda/sdb with /boot on sda1/sdb1 should 
always be done like:
-            # device (hd0) /dev/sd(a|b)
-            # root (hd0,0)
-            # setup (hd0)
-            
-            # get md device either if we use separate /boot or not.
-            [ -z $bootdev ] && local md=$PART_ROOT || local md=$bootdev
-            
-            local ask_str="Do you want to install grub to the MBR of each 
harddisk from your BOOT array "$md" ? (recommended)"
-            ask_yesno "$ask_str" yes
-            if [ $? -eq 0 ]; then
+               if [ "$DEVS" = " " ]; then
+                       notify "No hard drives were found"
+                       return 1
+               fi
+               # copy initial grub files into installed system
+               cp -a $var_TARGET_DIR/usr/lib/grub/i386-pc/* 
$var_TARGET_DIR/boot/grub/
+               sync
+               # freeze xfs filesystems to enable grub installation on xfs 
filesystems
+               for xfsdev in $(blkid -t TYPE=xfs -o device); do
+                       mnt=$(mount | grep $xfsdev | cut -d' ' -f 3)
+                       if [ $mnt = "$var_TARGET_DIR/boot" -o $mnt = 
"$var_TARGET_DIR/" ]; then
+                               /usr/sbin/xfs_freeze -f $mnt > /dev/null 2>&1
+                       fi
+               done
+
+               if [ ! $onraid ]; then
+                       # Set boot partition to the device where our /boot 
lives.
+                       [ -z $bootdev ] && bootpart=$PART_ROOT || 
bootpart=$bootdev
+                       ask_option no "Boot device selection" "Select the boot 
device where the GRUB bootloader will be installed (usually the MBR and not a 
partition)." required $DEVS || return 1
+                       bootdev=$ANSWER_OPTION
+                       boothd=$(echo $bootdev | cut -c -8)
+                       interactive_grub_install $bootpart $bootdev $boothd
+                       if [ $? -eq 0 ]; then
+                               GRUB_OK=1
+                       fi
+               else
+                       # Raid special
+                       # The bootpart and bootdev should not be changed when 
setup grub on all raid array members.
+                       # Instead the device is mapped via grub parameter device
+                       # So a grub setup on MBR sda/sdb with /boot on 
sda1/sdb1 should always be done like:
+                       # device (hd0) /dev/sd(a|b)
+                       # root (hd0,0)
+                       # setup (hd0)
+
+                       # get md device either if we use separate /boot or not.
+                       [ -z $bootdev ] && local md=$PART_ROOT || local 
md=$bootdev
+
+                       local ask_str="Do you want to install grub to the MBR 
of each harddisk from your BOOT array "$md" ? (recommended)"
+                       ask_yesno "$ask_str" yes
+                       if [ $? -eq 0 ]; then
                                slaves=$(mdraid_all_slaves $md)
-                for slave in $slaves; do
-                    boothd=$(echo $slave | cut -c -8)
-                    bootpart=$(mdraid_slave0 $md)
-                    bootdev=$(echo $bootpart | cut -c -8)
-                    interactive_grub_install $bootpart $bootdev $boothd
-                    if [ $? -eq 0 ]; then
-                        GRUB_OK=1
-                    fi
-                done
-            else
-                # This part needs more attention... User could select here only
-                # a other blockdevice to install grub into... But our grub 
rootdevice
-                # is not selectable, cause it is determined either from 
PART_ROOT or
-                # bootdev.
-                # Maybe better we leave the user alone and poke him to use a 
grub
-                # shell if he want do something unusefull and not install grub 
in
-                # aech MBR of affected HD in raid array....
-                local USERHAPPY=0
-                while [ "$USERHAPPY" = 0 ]
-                do
-                    ask_option no "Boot device selection" "Select the boot 
device where the GRUB bootloader will be installed." required $DEVS DONE _
-                    [ $? -gt 0                 ] && USERHAPPY=1 && break
-                    [ "$ANSWER_OPTION" == DONE ] && USERHAPPY=1 && break
-                    bootdev=$ANSWER_OPTION
-                    boothd=$(echo $bootdev | cut -c -8)
-                    bootpart=$(mdraid_slave0 $md)
-                    bootdev=$(echo $bootpart | cut -c -8)
-                    interactive_grub_install $bootpart $bootdev $boothd
-                    if [ $? -eq 0 ]; then
-                        GRUB_OK=1
-                    fi
-                done
+                               for slave in $slaves; do
+                                       boothd=$(echo $slave | cut -c -8)
+                                       bootpart=$(mdraid_slave0 $md)
+                                       bootdev=$(echo $bootpart | cut -c -8)
+                                       interactive_grub_install $bootpart 
$bootdev $boothd
+                                       if [ $? -eq 0 ]; then
+                                               GRUB_OK=1
+                                       fi
+                               done
+                       else
+                               # This part needs more attention... User could 
select here only
+                               # a other blockdevice to install grub into... 
But our grub rootdevice
+                               # is not selectable, cause it is determined 
either from PART_ROOT or
+                               # bootdev.
+                               # Maybe better we leave the user alone and poke 
him to use a grub
+                               # shell if he want do something unusefull and 
not install grub in
+                               # aech MBR of affected HD in raid array....
+                               local USERHAPPY=0
+                               while [ "$USERHAPPY" = 0 ]
+                               do
+                                       ask_option no "Boot device selection" 
"Select the boot device where the GRUB bootloader will be installed." required 
$DEVS DONE _
+                                       [ $? -gt 0                 ] && 
USERHAPPY=1 && break
+                                       [ "$ANSWER_OPTION" == DONE ] && 
USERHAPPY=1 && break
+                                       bootdev=$ANSWER_OPTION
+                                       boothd=$(echo $bootdev | cut -c -8)
+                                       bootpart=$(mdraid_slave0 $md)
+                                       bootdev=$(echo $bootpart | cut -c -8)
+                                       interactive_grub_install $bootpart 
$bootdev $boothd
+                                       if [ $? -eq 0 ]; then
+                                               GRUB_OK=1
+                                       fi
+                               done
                        fi
 
-            if [ "$bootpart" = "" ]; then
-                if [ "$PART_ROOT" = "" ]; then
-                    ask_string "Enter the full path to your root device" 
"/dev/sda3" || return 1
-                    bootpart=$ANSWER_STRING
-                else
-                    bootpart=$PART_ROOT
-                fi
-                boothd=$(echo $bootpart | cut -c -8)
-                interactive_grub_install $bootpart $bootdev $boothd
-                if [ $? -eq 0 ]; then
-                    GRUB_OK=1
-                fi
-            fi
-        fi
-        # unfreeze xfs filesystems
-        for xfsdev in $(blkid -t TYPE=xfs -o device); do
-            mnt=$(mount | grep $xfsdev | cut -d' ' -f 3)
-            if [ $mnt = "$var_TARGET_DIR/boot" -o $mnt = "$var_TARGET_DIR/" ]; 
then
-                /usr/sbin/xfs_freeze -u $mnt > /dev/null 2>&1
-            fi
-        done
-        
-        if [ "$GRUB_OK" == "1" ]; then
-            notify "GRUB was successfully installed."
-        else
-            show_warning "Grub installation failure" "GRUB was NOT 
successfully installed."
-            return 1
-        fi
-        return 0
-    fi
+                       if [ "$bootpart" = "" ]; then
+                               if [ "$PART_ROOT" = "" ]; then
+                                       ask_string "Enter the full path to your 
root device" "/dev/sda3" || return 1
+                                       bootpart=$ANSWER_STRING
+                               else
+                                       bootpart=$PART_ROOT
+                               fi
+                               boothd=$(echo $bootpart | cut -c -8)
+                               interactive_grub_install $bootpart $bootdev 
$boothd
+                               if [ $? -eq 0 ]; then
+                                       GRUB_OK=1
+                               fi
+                       fi
+               fi
+               # unfreeze xfs filesystems
+               for xfsdev in $(blkid -t TYPE=xfs -o device); do
+                       mnt=$(mount | grep $xfsdev | cut -d' ' -f 3)
+                       if [ $mnt = "$var_TARGET_DIR/boot" -o $mnt = 
"$var_TARGET_DIR/" ]; then
+                               /usr/sbin/xfs_freeze -u $mnt > /dev/null 2>&1
+                       fi
+               done
+
+               if [ "$GRUB_OK" == "1" ]; then
+                       notify "GRUB was successfully installed."
+               else
+                       show_warning "Grub installation failure" "GRUB was NOT 
successfully installed."
+                       return 1
+               fi
+               return 0
+       fi
 }
 
 generate_grub_menulst() {
@@ -1080,14 +1080,14 @@ interactive_bootloader_menu() {
        if [[ $1 = GRUB ]]; then
                generate_grub_menulst
        fi
-       
+
        grep -q '^/dev/mapper' $TMP_FSTAB && local helptext="  /dev/mapper/ 
users: Pay attention to the kernel line!"
        notify "Before installing $1, you must review the configuration file.  
You will now be put into the editor.  After you save your changes and exit the 
editor, you can install $1.$helptext"
-       
+
        if [[ -z $EDITOR ]]; then
                seteditor || return 1
        fi
-       
+
        $EDITOR $2
 }
 
@@ -1102,7 +1102,7 @@ interactive_grub_install () {
        # The boothd - Only on md raid setups this differs from bootdev
        # These values get parsed either from values we have already or from
        # user input. Later they will converted to grub-legacy notation.
-    
+
        # Convert to grub-legacy notation
        local bootpart=$(mapdev $1)
        if [ -z "$bootpart" ]; then
@@ -1118,7 +1118,7 @@ interactive_grub_install () {
        debug FS "bootpart: $bootpart"
        debug FS "bootdev: $bootdev"
        debug FS "boothd: $boothd"
-    
+
        $var_TARGET_DIR/sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
 device $bootdev $boothd
 root $bootpart
@@ -1220,7 +1220,6 @@ interactive_select_source() {
    return 0
 }
 
-
 # Prompt user for preferred mirror and set $var_SYNC_URL
 # args: none
 # returns: nothing
-- 
1.7.4

Reply via email to