#!/bin/bash set -ax project_name="sos-testing" project="--project ${project_name}" lxc="lxc ${project}" inst_name=sos-avocado01 distros="focal jammy lunar mantic" sos_location="$HOME/gitRepos/sos" lxc_exec="${lxc} exec" ${lxc} delete ${inst_name} --force lxc project create ${project_name} ${lxc} profile edit default < lxd_profile.yaml for distro in ${distros} do ${lxc} delete ${inst_name}-${distro} --force ${lxc} launch ubuntu:${distro} ${inst_name}-${distro} cd $sos_location tar cfz /tmp/sos.tgz . cd - ${lxc} file push /tmp/sos.tgz ${inst_name}-${distro}/root/sos.tgz while true ; do status=$(${lxc_exec} ${inst_name}-${distro} -- cloud-init status | grep status | awk '{print $2}') [[ "${status}" == "done" ]] && break [[ "${status}" == "error" ]] && break sleep 3 done ${lxc_exec} ${inst_name}-${distro} -- bash /root/run_avocado.sh ${lxc} stop ${inst_name}-${distro} done