1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/bin/sh
# image-customize script to prepare a bots VM for cockpit-podman testing
# This part applies to any scenario, cockpit-ws package or cockpit/ws container with beiboot
set -eu
if grep -q ID.*suse /usr/lib/os-release; then
# HACK: cgroups are not setup to let users use memory or cpu controllers
# https://bugzilla.suse.com/show_bug.cgi?id=1222450
mkdir -p /etc/systemd/system/user@.service.d
cat <<EOF > /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=cpu cpuset io memory pids
EOF
fi
if systemctl is-active -q firewalld.service; then
firewall-cmd --add-service=cockpit --permanent
fi
# Remove extra images, tests assume our specific set
# Since 4.0 podman now ships the pause image
podman images --format '{{.Repository}}:{{.Tag}}' | grep -Ev 'localhost/test-|pause|cockpit/ws' | xargs -r podman rmi -f
# clean up cockpit/ws on Fedora images, as it "breaks" pixel tests; it's only relevant for OSTree images and rhel-8 beiboot
if grep -q '^ID=.*fedora' /usr/lib/os-release && ! bootc status --booted; then
podman rmi -f quay.io/cockpit/ws || true
fi
# tests reset podman, save the images
mkdir -p /var/lib/test-images
for img in $(podman images --format '{{.Repository}}:{{.Tag}}'); do
fname="$(echo "$img" | tr -dc '[a-zA-Z-]')"
podman save -o "/var/lib/test-images/${fname}.tar" "$img"
done
# mitigate stupid/broken 90s timeout for user quadlet units
# https://github.com/containers/podman/issues/22197#issuecomment-2728794702
mkdir -p /etc/systemd/user/podman-user-wait-network-online.service.d
printf '[Service]\nExecStart=\nExecStart=/bin/true\n' > /etc/systemd/user/podman-user-wait-network-online.service.d/disable.conf
# HACK: unbreak subuid assignment for current and new users; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2382662
# https://issues.redhat.com/browse/RHEL-103765
if [ -e /etc/login.defs ]; then
sed -i '/^SUB_.ID_COUNT/ s/\b0/65536/' /etc/login.defs
fi
if ! grep -q admin /etc/subuid; then
usermod --add-subuids 100000-165535 admin
usermod --add-subgids 100000-165535 admin
fi
|