Fixed support for label making on xfs, added support for grub2-mkconfig
Kyle Sheumaker [Wed, 28 Jan 2015 15:08:57 +0000 (09:08 -0600)]
etc/cloner3/installer.sh
etc/cloner3/prep_disks.sh

index 5493f96..5827278 100755 (executable)
@@ -157,6 +157,7 @@ fi
 header "Installing bootloader"
 while read line
 do
+       GRUB2=0
        BL_DEVICE=`echo $line | awk '{print $1}'`
        BL_TYPE=`echo $line | awk '{print $2}'`
 
@@ -174,10 +175,12 @@ do
                        GRUB_PATH="/usr/sbin/grub-install"
                 elif [ -x /cloner/mnt/sbin/grub2-install ]
                 then
-                        GRUB_PATH="/sbin/grub2-install"
+                        GRUB_PATH="/sbin/grub2-install --force "
+                       GRUB2=1
                 elif  [ -x /cloner/mnt/usr/sbin/grub2-install ]
                 then
-                        GRUB_PATH="/usr/sbin/grub2-install"
+                        GRUB_PATH="/usr/sbin/grub2-install --force "
+                       GRUB2=1
                else
                        clone_fatal_error "Can't find the grub-install binary on mounted filesystem, no bootloader installed"
                fi
@@ -225,7 +228,29 @@ do
                        ok_msg
                else
                        fail_msg
-                       clone_fatal_error "Failed to install grub bootloader"
+                       clone_fatal_error "Failed to install lilo bootloader"
+               fi
+       fi
+
+       if [ "${GRUB2}" = "1" ]
+       then
+               if [ -x /cloner/mnt/sbin/grub2-mkconfig ]
+                then
+                        GRUB_MKCONFIG="/sbin/grub2-mkconfig "
+                elif  [ -x /cloner/mnt/usr/sbin/grub2-mkconfig ]
+                then
+                        GRUB_MKCONFIG="/usr/sbin/grub2-mkconfig "
+               else
+
+               msg -n "Creating grub2 config file"
+               server_log "Creating grub2 config file" "${_node}"
+               chroot /cloner/mnt ${GRUB_MKCONFIG} -o /boot/grub2/grub.conf >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       clone_fatal_error "Failed to create grub2 config file"
                fi
        fi
 
index 7d5dd01..a3f48e5 100755 (executable)
@@ -407,7 +407,7 @@ do
                                        CMD="/usr/bin/mkfs.xfs -f ${FS_DEVICE}"
                                        if [ "${FS_LABEL}" != "" ]
                                        then    
-                                               CMD="/usr/bin/mkfs.xfs -f ${FS_DEVICE} -L ${FS_LABEL}"
+                                               CMD="/usr/bin/mkfs.xfs -L ${FS_LABEL} -f ${FS_DEVICE}"
                                        fi
        
 
@@ -437,7 +437,7 @@ do
                                        CMD="/usr/bin/mkswap -f ${FS_DEVICE}"
                                        if [ "${FS_LABEL}" != "" ]
                                        then    
-                                               CMD="/usr/bin/mkswap -f ${FS_DEVICE} -L ${FS_LABEL}"
+                                               CMD="/usr/bin/mkswap -L ${FS_LABEL} -f ${FS_DEVICE}"
                                        fi
        
                                        $CMD >> /tmp/stdout.log 2>> /tmp/stderr.log