mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Add create_vm()
create_vm() is a helper function that will make it possible to remove boiler plate from (most) get_() functions.
This commit is contained in:
		
							parent
							
								
									29c2829534
								
							
						
					
					
						commit
						d20ad7aa1c
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		
							
								
								
									
										16
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								quickget
									
										
									
									
									
								
							|  | @ -1845,6 +1845,22 @@ function get_windows() { | ||||||
|     make_vm_config "${FILE_NAME}" "virtio-win.iso" |     make_vm_config "${FILE_NAME}" "virtio-win.iso" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | create_vm() { | ||||||
|  |     # shellcheck disable=SC2206 | ||||||
|  |     local URL_HASH=(${1// / }) | ||||||
|  |     local URL="${URL_HASH[0]}" | ||||||
|  |     local HASH="${URL_HASH[1]}" | ||||||
|  |     local ISO="${URL##*/}" | ||||||
|  |     #echo "${URL}" | ||||||
|  |     #echo "${ISO}" | ||||||
|  |     #echo "${HASH}" | ||||||
|  |     web_get "${URL}" "${VM_PATH}" | ||||||
|  |     if [ -n "${HASH}" ]; then | ||||||
|  |       check_hash "${ISO}" "${HASH}" | ||||||
|  |     fi | ||||||
|  |     make_vm_config "${ISO}" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| trap cleanup EXIT | trap cleanup EXIT | ||||||
| 
 | 
 | ||||||
| if ((BASH_VERSINFO[0] < 4)) | if ((BASH_VERSINFO[0] < 4)) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue