Skip to content

Commit

Permalink
rpm-ostree-container-bootc: do the os substitutions only in .ks.in
Browse files Browse the repository at this point in the history
  • Loading branch information
rvykydal committed Apr 4, 2024
1 parent c960efe commit aa25d11
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/fedora-bootc:eln

1 change: 1 addition & 0 deletions fragments/platform/rhel10/payload/ostreecontainer-bootc.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/centos-bootc:stream10
2 changes: 2 additions & 0 deletions fragments/platform/rhel9/payload/ostreecontainer-bootc.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=quay.io/centos-bootc/centos-bootc:stream9

22 changes: 18 additions & 4 deletions rpm-ostree-container-bootc.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
31 changes: 1 addition & 30 deletions rpm-ostree-container-bootc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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 \
Expand All @@ -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"
}
Expand Down

0 comments on commit aa25d11

Please sign in to comment.