Skip to content

Commit

Permalink
Fix add-apt-repositories.sh
Browse files Browse the repository at this point in the history
The loop syntax was wrong
Also add retry and failed message
  • Loading branch information
Flamefire authored Jul 3, 2024
1 parent 5cd7bc1 commit 05d689a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ci/add-apt-repositories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ set -eu
function do_add_repository {
name=$1
echo -e "\tAdding repository $name"
for i in {1..${NET_RETRY_COUNT:-3}}; do
sudo -E apt-add-repository -y "$name" && return 0 || sleep 10;
for i in $(seq ${NET_RETRY_COUNT:-3}); do
if [[ $i -ne 1 ]]; then
sleep 10
echo -e "\tRetrying"
fi
if sudo -E apt-add-repository -y "$name"; then
return 0
fi
done
echo "Failed adding $name"
return 1 # Failed
}

Expand Down

0 comments on commit 05d689a

Please sign in to comment.