test/system: Simplify the check for Fedora Rawhide

First, it's not a good idea to use awk(1) as a grep(1) replacement.
Unless one really needs the AWK programming language, it's better to
stick to grep(1) because it's simpler.

Secondly, it's better to look for a specific os-release(5) field instead
of looking for the occurrence of 'rawhide' anywhere in the file, because
it lowers the possibility of false positives.

https://github.com/containers/toolbox/pull/1336
This commit is contained in:
Debarshi Ray 2023-07-09 11:38:50 +02:00
parent 96791726a3
commit c846b6d844

View file

@ -33,7 +33,6 @@ setup_suite() {
return 1
fi
local os_release="$(find_os_release)"
local system_id="$(get_system_id)"
local system_version="$(get_system_version)"
@ -49,8 +48,7 @@ setup_suite() {
_pull_and_cache_distro_image ubuntu 20.04 || false
_pull_and_cache_distro_image busybox || false
# If run on Fedora Rawhide, cache 2 extra images (previous Fedora versions)
local rawhide_res="$(awk '/rawhide/' $os_release)"
if [ "$system_id" = "fedora" ] && [ -n "$rawhide_res" ]; then
if is_fedora_rawhide; then
_pull_and_cache_distro_image fedora "$((system_version-1))" || false
_pull_and_cache_distro_image fedora "$((system_version-2))" || false
fi