Update install.func
This commit is contained in:
		
							parent
							
								
									e6ebc2024e
								
							
						
					
					
						commit
						35d580287c
					
				| @ -282,22 +282,33 @@ get_gh_release() { | |||||||
|   local header=() |   local header=() | ||||||
|   local attempt=0 |   local attempt=0 | ||||||
|   local max_attempts=3 |   local max_attempts=3 | ||||||
|   local api_response tag |   local api_response tag http_code | ||||||
| 
 | 
 | ||||||
|   echo "🔍 Checking latest release for: $repo" |   echo "🔍 Checking latest release for: $repo" | ||||||
| 
 | 
 | ||||||
|   [[ -n "${GITHUB_TOKEN:-}" ]] && header=(-H "Authorization: token $GITHUB_TOKEN") |   [[ -n "${GITHUB_TOKEN:-}" ]] && header=(-H "Authorization: token $GITHUB_TOKEN") | ||||||
| 
 | 
 | ||||||
|   until [[ $attempt -ge $max_attempts ]]; do |   until [[ $attempt -ge $max_attempts ]]; do | ||||||
|     ((attempt++)) |     ((attempt++)) || true | ||||||
|     $STD msg_info "[$attempt/$max_attempts] Fetching GitHub release for $repo...\n" |     $STD msg_info "[$attempt/$max_attempts] Fetching GitHub release for $repo...\n" | ||||||
| 
 | 
 | ||||||
|     if ! api_response=$(curl -fsSL "${header[@]}" "$api_url"); then |     # Hole HTTP-Status explizit | ||||||
|       $STD msg_info "Request failed, retrying...\n" |     api_response=$(curl -fsSL -w "%{http_code}" -o /tmp/gh_resp.json "${header[@]}" "$api_url") | ||||||
|  |     http_code="${api_response:(-3)}" | ||||||
|  | 
 | ||||||
|  |     if [[ "$http_code" == "404" ]]; then | ||||||
|  |       msg_error "Repository $repo hat kein Release (404)" | ||||||
|  |       return 1 | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     if [[ "$http_code" != "200" ]]; then | ||||||
|  |       $STD msg_info "Request failed with HTTP $http_code, retrying...\n" | ||||||
|       sleep 2 |       sleep 2 | ||||||
|       continue |       continue | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|  |     api_response=$(</tmp/gh_resp.json) | ||||||
|  | 
 | ||||||
|     if echo "$api_response" | grep -q "API rate limit exceeded"; then |     if echo "$api_response" | grep -q "API rate limit exceeded"; then | ||||||
|       msg_error "GitHub API rate limit exceeded." |       msg_error "GitHub API rate limit exceeded." | ||||||
|       return 1 |       return 1 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 CanbiZ
						CanbiZ