66 lines
1.5 KiB
Bash
66 lines
1.5 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
latest_dev_series="noble"
|
||
|
latest_sup_series="mantic"
|
||
|
all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}"
|
||
|
sos_type="deb"
|
||
|
sos_channel="latest/candidate"
|
||
|
|
||
|
ppa_user="arif-ali"
|
||
|
ppa_name="sosreport-dev"
|
||
|
|
||
|
for series in ${all_series}
|
||
|
do
|
||
|
|
||
|
lxc_host=${series}01-sos
|
||
|
|
||
|
# clean up any previous containers
|
||
|
lxc delete ${lxc_host} --force
|
||
|
|
||
|
if [[ "${series}" == "${latest_dev_series}" ]] ; then
|
||
|
image=ubuntu-daily:devel
|
||
|
else
|
||
|
image=ubuntu:${series}
|
||
|
fi
|
||
|
|
||
|
lxc launch ${image} ${lxc_host} -s virtual
|
||
|
|
||
|
repo="sosreport-dev"
|
||
|
|
||
|
## need to wait for the instance to come up, and have networking
|
||
|
sleep 5
|
||
|
|
||
|
if [[ "${sos_type}" == "deb" ]] ; then
|
||
|
lxc exec ${lxc_host} -- sudo add-apt-repository -y ppa:${ppa_user}/${ppa_name}
|
||
|
|
||
|
if [[ "${series}" == "${latest_dev_series}" ]] ; then
|
||
|
|
||
|
filename="$(echo ${repo} | sed 's/\./_/g')"
|
||
|
|
||
|
lxc exec ${lxc_host} -- sed -i s/i${latest_sup_series}/${latest_dev_series}/g /etc/apt/sources.list.d/${ppa_user}-ubuntu-${filename}-${latest_sup_series}.list
|
||
|
|
||
|
fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
cat > test_sos.sh << EOF
|
||
|
#!/bin/bash
|
||
|
|
||
|
sos_type="${sos_type}"
|
||
|
|
||
|
apt -y update
|
||
|
apt -y --purge --autoremove remove sosreport
|
||
|
if [[ "\${sos_type}" == "deb" ]] ; then
|
||
|
apt -y install sosreport
|
||
|
elif [[ "\${sos_type}" == "snap" ]] ; then
|
||
|
snap install sosreport --channel ${sos_channel} --classic
|
||
|
fi
|
||
|
sos report -a --all-logs --batch
|
||
|
EOF
|
||
|
|
||
|
lxc file push test_sos.sh ${lxc_host}/root/test_sos.sh
|
||
|
lxc exec ${lxc_host} -- sudo bash /root/test_sos.sh
|
||
|
|
||
|
lxc delete ${lxc_host} --force
|
||
|
done
|