#!/usr/bin/env bash

export $(grep -v '^#' /etc/environment | xargs)
export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get install python3-pip docker.io libsquashfuse0 squashfuse fuse snapd -y
pip3 install pytest requests pyyaml sh psutil
# Attempting to address https://forum.snapcraft.io/t/lxd-refresh-cause-container-socket-error/8698
# if core is to be installed by microk8s it fails

# wait for the snapd seeding to take place!
n=0
until [ $n -ge 7 ]
do
  sudo snap install core && break  # substitute your command here
  n=$[$n+1]
  sleep 10
done


n=0
until [ $n -ge 7 ]
do
  sudo snap install core20 && break  # substitute your command here
  n=$[$n+1]
  sleep 10
done
