#!/bin/bash# update cockpit packages and install scripts in the containerset -eushopt -s failglob# keep in sync with containers/ws/install.shPACKAGES="kdumpnetworkmanagerpackagekitselinuxsosreportstoragedsystem"# Mount the container image so we can check some thingsws_mount=$(podman image mount quay.io/cockpit/ws)# Verify that we only install rpms from the correct distws_dist=".fc$(. "${ws_mount}/etc/os-release" && echo "${VERSION_ID}")"for pkg in ws bridge $PACKAGES; dorpm2cpio /var/tmp/cockpit-${pkg}-*${ws_dist}.*.rpm | cpio -i --make-directories --directory=/var/tmp/installdone# Verify Python version matches# basename with a suffix argument fails if the glob expands to more than one matchws_pylib="$(basename "${ws_mount}"/usr/lib/python3.* '')"if ! [ -d "/var/tmp/install/usr/lib/${ws_pylib}" ]; thenecho "ERROR: RPMs have different Python version than container (expected ${ws_pylib})" >&2exit 1fi# Copy those files into the container (we don't have RPM inside)podman run --name build-cockpit -i \-v /var/tmp/:/run/build:Z \quay.io/cockpit/ws sh -exc 'cp -a /run/build/install/* /cp /run/build/containers/ws/label-* /run/build/containers/ws/default-bastion.conf /run/build/containers/ws/cockpit-auth-ssh-key /container/# done in containers/ws/install.sh; this can be removed once that change is in our VM imagesrm -f /usr/libexec/cockpit-session'podman commit --change CMD=/container/label-run build-cockpit localhost/cockpit/wspodman rm -f build-cockpit# move original quay.io image away, to make sure that our tests use the updated onepodman tag quay.io/cockpit/ws:latest quay.io/cockpit/original-ws:releasedpodman rmi quay.io/cockpit/ws:latest