Debian Codegraph @

test/ws-container.install

raw
1 #!/bin/bash
2 # update cockpit packages and install scripts in the container
3 set -eu
4 shopt -s failglob
5
6 # keep in sync with containers/ws/install.sh
7 PACKAGES="
8 kdump
9 networkmanager
10 packagekit
11 selinux
12 sosreport
13 storaged
14 system
15 "
16
17 # Mount the container image so we can check some things
18 ws_mount=$(podman image mount quay.io/cockpit/ws)
19
20 # Verify that we only install rpms from the correct dist
21 ws_dist=".fc$(. "${ws_mount}/etc/os-release" && echo "${VERSION_ID}")"
22 for pkg in ws bridge $PACKAGES; do
23 rpm2cpio /var/tmp/cockpit-${pkg}-*${ws_dist}.*.rpm | cpio -i --make-directories --directory=/var/tmp/install
24 done
25
26 # Verify Python version matches
27 # basename with a suffix argument fails if the glob expands to more than one match
28 ws_pylib="$(basename "${ws_mount}"/usr/lib/python3.* '')"
29 if ! [ -d "/var/tmp/install/usr/lib/${ws_pylib}" ]; then
30 echo "ERROR: RPMs have different Python version than container (expected ${ws_pylib})" >&2
31 exit 1
32 fi
33
34 # Copy those files into the container (we don't have RPM inside)
35 podman run --name build-cockpit -i \
36 -v /var/tmp/:/run/build:Z \
37 quay.io/cockpit/ws sh -exc '
38 cp -a /run/build/install/* /
39 cp /run/build/containers/ws/label-* /run/build/containers/ws/default-bastion.conf /run/build/containers/ws/cockpit-auth-ssh-key /container/
40 # done in containers/ws/install.sh; this can be removed once that change is in our VM images
41 rm -f /usr/libexec/cockpit-session
42 '
43 podman commit --change CMD=/container/label-run build-cockpit localhost/cockpit/ws
44 podman rm -f build-cockpit
45
46 # move original quay.io image away, to make sure that our tests use the updated one
47 podman tag quay.io/cockpit/ws:latest quay.io/cockpit/original-ws:released
48 podman rmi quay.io/cockpit/ws:latest