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
This commit is contained in:
Debarshi Ray 2023-10-30 19:15:16 +01:00
parent 53e29feb51
commit 7725ee859c

View File

@ -161,6 +161,34 @@ rm -f /run/nologin # https://pagure.io/atomic-wg/issue/316
# Final pruning # Final pruning
rm -rfv /var/cache/* /var/log/* /tmp/* 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 %end
# Perform any necessary post-installation configurations specific to Fedora Toolbox (nochroot environment) # 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 %post --nochroot --erroronfail --log=/mnt/sysimage/root/anaconda-post-nochroot.log
set -eux 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 # Clean up dnf cache
dnf clean all dnf clean all