diff --git a/config/global_constants.go b/config/global_constants.go index b26e4d9..f4603d5 100644 --- a/config/global_constants.go +++ b/config/global_constants.go @@ -7,17 +7,19 @@ package config const ( // PackageManagerLoopFunction is a bash function that executes its arguments // in a loop with a delay until either the command either returns - // with an exit code other than 100. + // with an exit code other than 100. It times out after 5 failed attempts. PackageManagerLoopFunction = ` function package_manager_loop { + local attempts=0 local rc= while true; do + attempts=$((attempts+1)) if ($*); then return 0 else rc=$? fi - if [ $rc -eq 100 ]; then + if [ $attempts -lt 5 -a $rc -eq 100 ]; then sleep 10s continue fi