Geode: Revert build slave back to Ubuntu 18.04
[infra/cicd.git] / jjb / geode / apache-geode-slave / slave_setup.sh
index ef32cd12dbce4dc89b92957a141f6e424398e16e..306636a4afaaceced4750303bf1c667bdc520fd4 100755 (executable)
@@ -19,6 +19,20 @@ set -o nounset
 set -o errexit
 set -o pipefail
 set -o xtrace
+DPKG_LOCK="/var/lib/dpkg/lock-frontend"
+
+# Wait for other apt process to finish by checking the dpkg lock file.
+try=0
+while sudo lsof ${DPKG_LOCK}  > /dev/null 2>&1 ; do
+  echo "DPKG file locked: ${DPKG_LOCK}."
+  echo "   Waiting for another pkg instalaltion process to finish ..."
+  sleep 10
+  if [[ ${try} -gt 60 ]] ; then
+    echo "ERROR: Max number of re-tries reached, exiting..."
+    exit 1
+  fi
+  try=$((try + 1))
+done
 
 sudo apt-get update
 sudo apt-get install -y --no-install-recommends \