mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Add check_hash() function
This commit is contained in:
		
							parent
							
								
									dacc7913e1
								
							
						
					
					
						commit
						e1d15d4f04
					
				
					 1 changed files with 22 additions and 0 deletions
				
			
		
							
								
								
									
										22
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								quickget
									
										
									
									
									
								
							|  | @ -8,6 +8,7 @@ | ||||||
| #  4. Add the new OS to make_vm_config() | #  4. Add the new OS to make_vm_config() | ||||||
| #  5. Create a get_newos() function that does something like this: | #  5. Create a get_newos() function that does something like this: | ||||||
| #     function get_newos() { | #     function get_newos() { | ||||||
|  | #         local HASH="" | ||||||
| #         local ISO="" | #         local ISO="" | ||||||
| #         local URL="" | #         local URL="" | ||||||
| # | # | ||||||
|  | @ -15,6 +16,9 @@ | ||||||
| #         ISO="newos-${RELEASE}-amd64.iso" | #         ISO="newos-${RELEASE}-amd64.iso" | ||||||
| #         URL="https://www.newos.org/download/${ISO}" | #         URL="https://www.newos.org/download/${ISO}" | ||||||
| #         web_get "${URL}" "${VM_PATH}" | #         web_get "${URL}" "${VM_PATH}" | ||||||
|  | #         web_get "${URL}/SHA256SUMS" "${VM_PATH}" | ||||||
|  | #         HASH=$(cat "${VM_PATH}/SHA256SUMS" | cut -d' ' -f1) | ||||||
|  | #         check_hash "${VM_PATH}/${ISO}" "${HASH}" sha256sum | ||||||
| #         make_vm_config "${ISO}" | #         make_vm_config "${ISO}" | ||||||
| #     } | #     } | ||||||
| #  6. Add new OS to the argument parser at the bottom of the script | #  6. Add new OS to the argument parser at the bottom of the script | ||||||
|  | @ -394,6 +398,24 @@ function unattended_windows() { | ||||||
| EOF | EOF | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function check_hash() { | ||||||
|  |     local iso="" | ||||||
|  |     local hash="" | ||||||
|  |     local hash_algo="" | ||||||
|  |     iso="${1}" | ||||||
|  |     hash="${2}" | ||||||
|  |     hash_algo="${3}" | ||||||
|  | 
 | ||||||
|  |     echo -n "Checking ${iso} with ${hash_algo}... " | ||||||
|  |     if ! echo "${hash} ${iso}" | ${hash_algo} --check --status; then | ||||||
|  |         echo "ERROR!" | ||||||
|  |         echo "${iso} doesn't match ${hash}. Try running 'quickget' again." | ||||||
|  |         exit 1 | ||||||
|  |     else | ||||||
|  |         echo "Good!" | ||||||
|  |     fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function web_get() { | function web_get() { | ||||||
|     local DIR="${2}" |     local DIR="${2}" | ||||||
|     local FILE="" |     local FILE="" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue