mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Fiz get_zsync() so it correctly falls back to web_get()
This commit is contained in:
		
							parent
							
								
									6b86e81e72
								
							
						
					
					
						commit
						eaae0f72e8
					
				
					 1 changed files with 23 additions and 22 deletions
				
			
		
							
								
								
									
										45
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								quickget
									
										
									
									
									
								
							|  | @ -639,36 +639,37 @@ function web_get() { | ||||||
| 
 | 
 | ||||||
| function zsync_get() { | function zsync_get() { | ||||||
|     local DIR="${2}" |     local DIR="${2}" | ||||||
|     local FILE="" |     local FILE="${1##*/}" | ||||||
|     local OUT="" |     local OUT="" | ||||||
|     local URL="${1}" |     local URL="${1}" | ||||||
|     local ZS="" |  | ||||||
| 
 |  | ||||||
|     FILE="${URL##*/}" |  | ||||||
| 
 | 
 | ||||||
|     if command -v zsync &>/dev/null; then |     if command -v zsync &>/dev/null; then | ||||||
|       if [ -n "${3}" ]; then |         if [ -n "${3}" ]; then | ||||||
|           OUT="${3}" |             OUT="${3}" | ||||||
|       else |         else | ||||||
|           OUT="${FILE}" |             OUT="${FILE}" | ||||||
|       fi |         fi | ||||||
| 
 | 
 | ||||||
|       if ! mkdir -p "${DIR}" 2>/dev/null; then |         if ! mkdir -p "${DIR}" 2>/dev/null; then | ||||||
|         echo "ERROR! Unable to create directory ${DIR}" |           echo "ERROR! Unable to create directory ${DIR}" | ||||||
|         exit 1 |  | ||||||
|       fi |  | ||||||
| 
 |  | ||||||
|       if ! zsync "${URL}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then |  | ||||||
|           echo "ERROR! Failed to download ${URL}.zsync" |  | ||||||
|           exit 1 |           exit 1 | ||||||
|       fi |         fi | ||||||
| 
 | 
 | ||||||
|       if [ -e "${DIR}/${OUT}.zs-old" ]; then |         if ! zsync "${URL}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then | ||||||
|           rm "${DIR}/${OUT}.zs-old" |             echo "ERROR! Failed to download ${URL}.zsync" | ||||||
|       fi |             exit 1 | ||||||
|  |         fi | ||||||
|  | 
 | ||||||
|  |         if [ -e "${DIR}/${OUT}.zs-old" ]; then | ||||||
|  |             rm "${DIR}/${OUT}.zs-old" | ||||||
|  |         fi | ||||||
|     else |     else | ||||||
|       echo "INFO: zsync not found, falling back to wget/aria2c" |         echo "INFO: zsync not found, falling back to wget/aria2c" | ||||||
|       web_get "${ISO}" "${DIR}" |         if [ -n "${3}" ]; then | ||||||
|  |             web_get "${1}" "${2}" "${3}" | ||||||
|  |         else | ||||||
|  |             web_get "${1}" "${2}" | ||||||
|  |         fi | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue