From b0d013aedab978e7d945ae8016e0df0a9dd0bf68 Mon Sep 17 00:00:00 2001 From: Matus Marhefka Date: Mon, 21 Mar 2022 16:12:35 +0100 Subject: [PATCH] tests/probes/rpm/rpm_common.sh: update wrt Fedora 36 RPM DB change Since Fedora 36 RPM database location changed, see https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr --- tests/probes/rpm/rpm_common.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/probes/rpm/rpm_common.sh b/tests/probes/rpm/rpm_common.sh index 2438272557..31b3f3fcd1 100755 --- a/tests/probes/rpm/rpm_common.sh +++ b/tests/probes/rpm/rpm_common.sh @@ -9,6 +9,13 @@ RPMBASE="${builddir}/tests/probes/rpm" RPMTEST="${RPMBASE}/root" RPMBUILD="${RPMBASE}/build" +# Since Fedora 36 RPM database location changed, see +# https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr +if [ -d "/usr/lib/sysimage/rpm/" ]; then + RPMDB_PATH="/usr/lib/sysimage/rpm/" +else + RPMDB_PATH="/var/lib/rpm/" +fi function rpm_build { require "rpmbuild" || return 255 @@ -28,8 +35,8 @@ function rpm_prepare_offline { cp /usr/lib/rpm/rpmrc ${RPMTEST}/usr/lib/rpm/rpmrc cp /usr/lib/rpm/macros ${RPMTEST}/usr/lib/rpm/macros rpm_build - rpm -i ${RPMBUILD}/RPMS/noarch/foobar-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}/var/lib/rpm/" - rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}/var/lib/rpm/" + rpm -i ${RPMBUILD}/RPMS/noarch/foobar-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}" + rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}" } function rpm_cleanup_offline { @@ -40,7 +47,7 @@ function rpm_cleanup_offline { function rpm_query { require "rpm" || return 255 if [ -d "$OSCAP_PROBE_ROOT" ]; then - DB="--dbpath=$OSCAP_PROBE_ROOT/var/lib/rpm/" + DB="--dbpath=${OSCAP_PROBE_ROOT}${RPMDB_PATH}" fi rpm $DB --qf "%{$2}\n" -q $1 | head - }