mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Detect if a disk has (most likely) not been installed to and handle accordingly
The default qcow2 is 197632, so double that and anything smaller is considered unsed. Makes booting to a live session many times easier.
This commit is contained in:
		
							parent
							
								
									27e5b6a174
								
							
						
					
					
						commit
						34147ab202
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		
							
								
								
									
										15
									
								
								quickemu.sh
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								quickemu.sh
									
										
									
									
									
								
							|  | @ -83,11 +83,20 @@ function vm_boot() { | |||
|     echo " - BIOS:     Legacy" | ||||
|   fi | ||||
| 
 | ||||
|   echo " - Disk:     ${disk_img}" | ||||
|   echo " - Size:     ${disk}" | ||||
|   echo " - Disk:     ${disk_img} (${disk})" | ||||
|   # If the disk is present but doesn't appear to have an install, then | ||||
|   # remove it. | ||||
|   if [ -e ${disk_img} ]; then | ||||
|     local disk_curr_size=$(stat -c%s "${disk_img}") | ||||
|     if [ ${disk_curr_size} -le 395264 ]; then | ||||
|       echo "             Looks unused, recreating." | ||||
|       rm "${disk_img}" | ||||
|     fi | ||||
|   fi | ||||
| 
 | ||||
|   if [ ! -f "${disk_img}" ]; then | ||||
|     # If there is no disk image, create a new image. | ||||
|     qemu-img create -q -f qcow2 "${disk_img}" "${disk}" | ||||
|     ${QEMU_IMG} create -q -f qcow2 "${disk_img}" "${disk}" | ||||
|     if [ $? -ne 0 ]; then | ||||
|       echo "ERROR! Failed to create ${disk_img} of ${disk}. Stopping here." | ||||
|       exit 1 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue