mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	check_hash() will automatically add the VM_PATH and derive the hash algorithm
This commit is contained in:
		
							parent
							
								
									e24f34ad9d
								
							
						
					
					
						commit
						ef94ff64ff
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		
							
								
								
									
										12
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								quickget
									
										
									
									
									
								
							|  | @ -403,9 +403,17 @@ function check_hash() { | |||
|     local iso="" | ||||
|     local hash="" | ||||
|     local hash_algo="" | ||||
|     iso="${1}" | ||||
|     iso="${VM_PATH}/${1}" | ||||
|     hash="${2}" | ||||
|     hash_algo="${3}" | ||||
| 
 | ||||
|     # Guess the hash algorithm by the hash length | ||||
|     case ${#hash} in | ||||
|       32) hash_algo=md5sum;; | ||||
|       40) hash_algo=sha1sum;; | ||||
|       64) hash_algo=sha256sum;; | ||||
|        *) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash." | ||||
|           return;; | ||||
|     esac | ||||
| 
 | ||||
|     echo -n "Checking ${iso} with ${hash_algo}... " | ||||
|     if ! echo "${hash} ${iso}" | ${hash_algo} --check --status; then | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue