spec: Fix ownership of the dnf-json rpmmd files

dnf-json previously ran as a service, and the
/var/cache/osbuild-composer/rpmmd directory and files were owned by
root. As a script called from osbuild-composer those directories and
files need to be owned by _osbuild-composer:_osbuild-composer, otherwise
it will not be able to depsolve after an upgrade from the previous
implementation.

This can be worked around by removing the
/var/cache/osbuild-composer/rpmmd directory and restarting the service
or rebooting.

Fixes #3079
This commit is contained in:
Brian C. Lane 2022-10-19 14:31:03 -07:00 committed by Tomáš Hozza
parent 8fdd158799
commit d1e69fe528

View file

@ -350,6 +350,12 @@ The dnf-json binary used by osbuild-composer and the workers.
%files dnf-json
%{_libexecdir}/osbuild-composer/dnf-json
%post dnf-json
# Fix ownership of the rpmmd cache files from previous versions where it was owned by root:root
if [ -e /var/cache/osbuild-composer/rpmmd ]; then
chown -f -R --from root:root _osbuild-composer:_osbuild-composer /var/cache/osbuild-composer/rpmmd
fi
%if %{with tests} || 0%{?rhel}
%package tests