From 7725ee859c472dbf303f131c534d3560c38e37cd Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Mon, 30 Oct 2023 19:15:16 +0100 Subject: [PATCH] container-toolbox: Restore the tests The tests can't be run inside the '%post --nochroot' section because the paths being tested don't include the /mnt/sysimage prefix. The tests must be run in the %post section without --nochroot so that they are run inside the chroot environment. The translations for the RPM manuals were removed upstream during the RPM 4.19 development cycle [1]. So, replace them with rpm2cpio(8), which is another popular command shipped by the rpm package. [1] RPM commit 4df74a9644b18136 https://github.com/rpm-software-management/rpm/commit/4df74a9644b18136 https://github.com/rpm-software-management/rpm/pull/2245 https://pagure.io/fedora-kickstarts/pull-request/1008 --- fedora-container-toolbox.ks | 58 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/fedora-container-toolbox.ks b/fedora-container-toolbox.ks index eb7efb2..c8d00fb 100644 --- a/fedora-container-toolbox.ks +++ b/fedora-container-toolbox.ks @@ -161,6 +161,34 @@ rm -f /run/nologin # https://pagure.io/atomic-wg/issue/316 # Final pruning rm -rfv /var/cache/* /var/log/* /tmp/* +# Check if specified files exist +declare -a files=( + "/usr/share/man/man1/bash.1*" + "/usr/share/man/man1/cd.1*" + "/usr/share/man/man1/export.1*" + "/usr/share/man/man1/cat.1*" + "/usr/share/man/man1/cp.1*" + "/usr/share/man/man1/ls.1*" + "/usr/share/man/man1/gpg2.1*" + "/usr/share/man/man7/gnupg2.7*" + "/usr/share/man/man8/rpm.8*" + "/usr/share/man/man8/rpm2cpio.8*" + "/usr/share/man/man1/kill.1*" + "/usr/share/man/man8/mount.8*" +) + +ret_val=0 +for file in "${files[@]}"; do + if ! compgen -G "$file" >/dev/null; then + echo "$file: No such file or directory" >&2 + ret_val=1 + break + fi +done + +if [ "$ret_val" -ne 0 ]; then + false +fi %end # Perform any necessary post-installation configurations specific to Fedora Toolbox (nochroot environment) @@ -169,36 +197,6 @@ rm -rfv /var/cache/* /var/log/* /tmp/* %post --nochroot --erroronfail --log=/mnt/sysimage/root/anaconda-post-nochroot.log set -eux -# Check if specified files exist -#declare -a files=( -# "/usr/share/man/man1/bash.1*" -# "/usr/share/man/man1/cd.1*" -# "/usr/share/man/man1/export.1*" -# "/usr/share/man/man1/cat.1*" -# "/usr/share/man/man1/cp.1*" -# "/usr/share/man/man1/ls.1*" -# "/usr/share/man/man1/gpg2.1*" -# "/usr/share/man/man7/gnupg2.7*" -# "/usr/share/man/fr/man8/rpm.8*" -# "/usr/share/man/ja/man8/rpm.8*" -# "/usr/share/man/man8/rpm.8*" -# "/usr/share/man/man1/kill.1*" -# "/usr/share/man/man8/mount.8*" -#) - -#ret_val=0 -#for file in "${files[@]}"; do -# if ! compgen -G "$file" >/dev/null; then -# echo "$file: No such file or directory" >&2 -# ret_val=1 -# break -# fi -#done - -#if [ "$ret_val" -ne 0 ]; then -# false -#fi - # Clean up dnf cache dnf clean all