More fixes for uuid
Kyle Sheumaker [Fri, 21 Sep 2018 21:00:11 +0000 (16:00 -0500)]
etc/cloner3/installer.sh
etc/cloner3/uuid_fix.sh

index 9008151..c89eaa1 100755 (executable)
@@ -185,7 +185,17 @@ then
 fi
 
 # mounting 
-header "Mounting proc & sys filesystem in deployed image"
+
+header "Mounting virutal filesystems in deployed image"
+msg -n "Mounting /dev to /cloner/mnt/dev"
+mount -o bind /dev /cloner/mnt/dev
+if [ "$?" = "0" ]
+then
+       ok_msg
+else
+       fail_msg
+fi
+
 msg -n "Mounting /cloner/mnt/proc"
 mount -t proc none /cloner/mnt/proc
 if [ "$?" = "0" ]
@@ -206,6 +216,10 @@ fi
 
 # fix the filesystem UUID issues
 /etc/cloner3/uuid_fix.sh
+if [ "$?" != "0" ]
+then
+       clone_fatal_error "Can't fix UUIDs"
+fi
        
 
 header "Installing bootloader"
@@ -319,14 +333,25 @@ done < /cloner/setup/bootloader
 if [ -e /cloner/setup/efi ]
 then
 
+
        EFIBOOTMGR=/usr/sbin/efibootmgr
        header "Setting up EFI"
 
+       msg -n "Mounting EFIvars filesystem"
+       mount -t efivarfs none /cloner/mnt/sys/firmware/efi/efivars
+       if [ "$?" = "0" ]
+       then
+               ok_msg
+       else
+               fail_msg
+               clone_fatal_error "Can't mount efivars filesystem"
+       fi
+
        EFIARGS=`cat /cloner/setup/efi`
 
        msg -n "Running efibootmgr ${EFIARGS}"
        server_log "Running efibootmgr ${EFIARGS}" "${_node}"
-       chroot /cloner/mnt ${EFIBOOTMGR} ${EFIARGS} >> /tmp/stdout.log 2>> /tmp/stderr.log
+       chroot /cloner/mnt ${EFIBOOTMGR} ${EFIARGS}  >> /tmp/stdout.log 2>> /tmp/stderr.log
        if [ "$?" = "0" ]
        then
                ok_msg
@@ -335,6 +360,8 @@ then
                clone_fatal_error "Failed to run ${EFIBOOTMGR} ${EFIARGS}"
        fi
 
+       umount /cloner/mnt/sys/firmware/efi/efivars
+
        GRUB_MKCONFIG=""
        GRUB2_CONFIG="/etc/grub2-efi.cfg"
        if [ -x /cloner/mnt/sbin/grub2-mkconfig ]
@@ -382,6 +409,7 @@ server_log "Unmounting filesystems" "${_node}"
 
 umount /cloner/mnt/proc
 umount /cloner/mnt/sys
+umount /cloner/mnt/dev
 
 while read line
 do
index 9145cc3..2bbc308 100755 (executable)
@@ -61,7 +61,7 @@ convert_fstab() {
                        if [ "${NEW_UUID}" = "" ]
                        then
                                clone_fatal_error "Can't find new UUID for ${DEVICE}"
-                               return 1
+                               exit 1
                        fi
                        msg -n " found ${ANSI_BLUE}${NEW_UUID}${ANSI_DONE}"
                        ok_msg
@@ -83,6 +83,7 @@ then
        if [ "$?" != "0" ]
        then
                clone_fatal_error "Can't convert UUIDs from old fstab to new."
+               exit 1
        fi
 
        if [ -e /tmp/fstab.converted ]
@@ -116,9 +117,11 @@ then
                                ok_msg
                        else
                                clone_fatal_error "Can't update initrd for ${kver} with dracut"
+                               exit 1
                        fi
                done
        fi
 
 fi
 
+exit 0