github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/simple-resource-http/hooks/install (about)

     1  #!/bin/bash
     2  
     3  # Try multiple times to apt update and install
     4  
     5  try_count=0
     6  while ! apt-get update; do
     7      echo "Waiting 5 seconds"
     8      if [ $try_count -lt 10 ] ; then
     9          sleep 5
    10      else
    11          echo "Giving up."
    12          break
    13      fi
    14      try_count=$((try_count+1))
    15  done
    16  
    17  try_count=0
    18  while ! apt-get install -y python; do
    19      echo "Waiting 5 seconds"
    20      if [ $try_count -lt 10 ] ; then
    21          sleep 5
    22      else
    23          echo "Giving up."
    24          break
    25      fi
    26      try_count=$((try_count+1))
    27  done
    28  
    29  
    30  status-set maintenance "Installed" || true