Only install kata if not installed already

This commit is contained in:
Peter Šurda 2021-02-12 08:19:23 +01:00
parent e2e6c24d13
commit 3972c89019
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -27,16 +27,17 @@ mem=$(sed -E 's/^MemTotal: +([0-9]+) kB/\1/p;d' < /proc/meminfo)
mempercore=$(((mem/1024-4096)/cores)) mempercore=$(((mem/1024-4096)/cores))
# install kata containers # install kata containers
echo "Installing kata...." if ! docker info 2>/dev/null|grep Runtimes:|grep -qs kata-qemu-virtiofs; then
cid=$(docker run -d --runtime=runc -v /opt/kata:/opt/kata -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /etc/docker:/etc/docker -it katadocker/kata-deploy kata-deploy-docker install) echo "Installing kata...."
# wait for finish cid=$(docker run -d --runtime=runc -v /opt/kata:/opt/kata -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /etc/docker:/etc/docker -it katadocker/kata-deploy kata-deploy-docker install)
while [ "$(docker container inspect -f '{{.State.Running}}' "$cid")" == "true" ]; do # wait for finish
while [ "$(docker container inspect -f '{{.State.Running}}' "$cid")" == "true" ]; do
sleep 1 sleep 1
done done
echo "Kata installed" # update default container CPU and memory
sed -i "s/default_vcpus = .*/default_vcpus = 2/g;s/default_memory = .*/default-memory = $mempercore/g" /opt/kata/share/defaults/kata-containers/configuration-qemu-virtiofs.toml
# update default container CPU and memory echo "Kata installed"
sed -i "s/default_vcpus = .*/default_vcpus = 2/g;s/default_memory = .*/default-memory = $mempercore/g" /opt/kata/share/defaults/kata-containers/configuration-qemu-virtiofs.toml fi
trusty trusty
xenial xenial