From aa25d11dae4ec690576197843e0f367c9cd72a48 Mon Sep 17 00:00:00 2001 From: Radek Vykydal Date: Wed, 27 Mar 2024 13:29:23 +0100 Subject: [PATCH] rpm-ostree-container-bootc: do the os substitutions only in .ks.in --- .../payload/ostreecontainer-bootc.ks | 2 ++ .../rhel10/payload/ostreecontainer-bootc.ks | 1 + .../rhel9/payload/ostreecontainer-bootc.ks | 2 ++ rpm-ostree-container-bootc.ks.in | 22 ++++++++++--- rpm-ostree-container-bootc.sh | 31 +------------------ 5 files changed, 24 insertions(+), 34 deletions(-) create mode 100644 fragments/platform/fedora_rawhide/payload/ostreecontainer-bootc.ks create mode 100644 fragments/platform/rhel10/payload/ostreecontainer-bootc.ks create mode 100644 fragments/platform/rhel9/payload/ostreecontainer-bootc.ks diff --git a/fragments/platform/fedora_rawhide/payload/ostreecontainer-bootc.ks b/fragments/platform/fedora_rawhide/payload/ostreecontainer-bootc.ks new file mode 100644 index 00000000..c8486f88 --- /dev/null +++ b/fragments/platform/fedora_rawhide/payload/ostreecontainer-bootc.ks @@ -0,0 +1,2 @@ +ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/fedora-bootc:eln + diff --git a/fragments/platform/rhel10/payload/ostreecontainer-bootc.ks b/fragments/platform/rhel10/payload/ostreecontainer-bootc.ks new file mode 100644 index 00000000..957dcd40 --- /dev/null +++ b/fragments/platform/rhel10/payload/ostreecontainer-bootc.ks @@ -0,0 +1 @@ +ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/centos-bootc:stream10 diff --git a/fragments/platform/rhel9/payload/ostreecontainer-bootc.ks b/fragments/platform/rhel9/payload/ostreecontainer-bootc.ks new file mode 100644 index 00000000..1fdd6ec8 --- /dev/null +++ b/fragments/platform/rhel9/payload/ostreecontainer-bootc.ks @@ -0,0 +1,2 @@ +ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/centos-bootc:stream9 + diff --git a/rpm-ostree-container-bootc.ks.in b/rpm-ostree-container-bootc.ks.in index 71109adb..6f59ae3f 100644 --- a/rpm-ostree-container-bootc.ks.in +++ b/rpm-ostree-container-bootc.ks.in @@ -5,7 +5,7 @@ # Use the default settings. %ksappend common/common_no_payload.ks -# The RPM OSTree source is set up by the test script +%ksappend payload/ostreecontainer-bootc.ks # Reboot the installed system. reboot @@ -14,11 +14,9 @@ reboot %ksappend validation/success_on_first_boot.ks %post -# Checks in %post -# Check of the remote URL is appended by the test script # Checks after boot -cat >> /opt/kickstart-tests/kickstart-test.sh << 'EOF' +cat >> /var/lib/extensions/kickstart-tests/usr/libexec/kickstart-test.sh << 'EOF' # propagate any errors from %post validations if [ -e /root/RESULT ]; then @@ -38,5 +36,21 @@ fi bootupctl --help &> /dev/null || echo "bootupctl command not available after booting" bootc --help &> /dev/null || echo "bootc command not available after booting" +if [[ "@KSTEST_OS_NAME@" == "rhel" ]]; then + expected_url="quay.io/centos-bootc/centos-bootc:stream9" +else + expected_url="quay.io/centos-bootc/fedora-bootc:eln" +fi + +remote_url="$(ostree remote show-url test-remote)" +if [ ${?} -ne 0 ]; then + echo "Couldn't list remote URL for 'test-remote'" >> /root/RESULT +fi + +if [ "${remote_url}" != "${expected_url}" ]; then + echo "Unexpected URL: ${remote_url}, expected ${expected_url}"" >> /root/RESULT +fi + + EOF %end diff --git a/rpm-ostree-container-bootc.sh b/rpm-ostree-container-bootc.sh index b3bb79a6..f955cf67 100755 --- a/rpm-ostree-container-bootc.sh +++ b/rpm-ostree-container-bootc.sh @@ -19,17 +19,9 @@ # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 TESTTYPE="payload ostree bootc reboot skip-on-rhel-8 skip-on-rhel-10" -# skip-on-rhel" . ${KSTESTDIR}/functions.sh -os_major=${KSTEST_OS_VERSION%%.*} -if [ "${KSTEST_OS_NAME}" == "rhel" ]; then - container_url="quay.io/centos-bootc/centos-bootc:stream${os_major}" -else - container_url="quay.io/centos-bootc/fedora-bootc:eln" -fi - copy_interesting_files_from_system() { local disksdir disksdir="${1}" @@ -59,7 +51,7 @@ copy_interesting_files_from_system() { launch lvs" | \ grep root) - + for item in /ostree/deploy/test-stateroot/var/roothome/original-ks.cfg \ /ostree/deploy/test-stateroot/var/roothome/anaconda-ks.cfg \ /ostree/deploy/test-stateroot/var/roothome/anabot.log \ @@ -74,27 +66,6 @@ copy_interesting_files_from_system() { done } -prepare() { - ks=${1} - cat >> ${ks} << EOF1 -ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=${container_url} - -%post -cat >> /var/lib/extensions/kickstart-tests/usr/libexec/kickstart-test.sh << EOF2 -remote_url="\\\$(ostree remote show-url test-remote)" -if [ \\\${?} -ne 0 ]; then - echo "Couldn't list remote URL for 'test-remote'" >> /root/RESULT -fi - -if [ "\\\${remote_url}" != "${container_url}" ]; then - echo "Unexpected URL: \\\${remote_url}, expected ${container_url}" >> /root/RESULT -fi -EOF2 -%end -EOF1 - echo ${ks} -} - get_timeout() { echo "80" }