diff --git a/units.spec b/units.spec index 8e8bd58..19e53fa 100644 --- a/units.spec +++ b/units.spec @@ -1,12 +1,14 @@ Summary: A utility for converting amounts from one unit to another Name: units Version: 2.21 -Release: 4%{?dist} +Release: 5%{?dist} Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz +Source1: units.tmpfiles.conf URL: https://www.gnu.org/software/units/units.html License: GPLv3+ BuildRequires: automake BuildRequires: bison +BuildRequires: systemd-rpm-macros BuildRequires: gcc BuildRequires: make BuildRequires: ncurses-devel @@ -37,11 +39,32 @@ make %{?_smp_mflags} %install make install DESTDIR=$RPM_BUILD_ROOT -gzip $RPM_BUILD_ROOT%{_infodir}/units.info +# Copy dynamic files to defaults directory as templates for tmpfiles.d +mkdir -p %{buildroot}%{_datadir}/units/defaults +cp -p %{buildroot}%{_sharedstatedir}/units/currency.units %{buildroot}%{_datadir}/units/defaults/ + +# Remove /var/lib/units from buildroot - now managed by tmpfiles.d +rm -rf %{buildroot}%{_sharedstatedir}/units + +# Replace absolute symlinks by relative symlinks +ln -fsv ../../../var/lib/units/currency.units %{buildroot}%{_datadir}/units/currency.units + +# Install tmpfiles.d configuration for Image Mode support +install -m0644 -D %{SOURCE1} %{buildroot}%{_tmpfilesdir}/units.conf + +gzip %{buildroot}%{_infodir}/units.info # provide a man page for units_cur as a symlink to units.1 ln -s units.1 %{buildroot}%{_mandir}/man1/units_cur.1 +%post +%tmpfiles_create units.conf + +%postun +if [ $1 -eq 0 ]; then + systemd-tmpfiles --purge %{_tmpfilesdir}/units.conf 2>/dev/null || : +fi + %check make check @@ -50,11 +73,14 @@ make check %{_bindir}/units %{_bindir}/units_cur %{_datadir}/units -%{_sharedstatedir}/units +%{_tmpfilesdir}/units.conf %{_infodir}/* %{_mandir}/man1/* %changelog +* Wed Apr 22 2026 Jan Macku - 2.21-5 +- fix units compatibility with Image Mode + * Tue Aug 10 2021 Mohan Boddu - 2.21-4 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 diff --git a/units.tmpfiles.conf b/units.tmpfiles.conf new file mode 100644 index 0000000..d296303 --- /dev/null +++ b/units.tmpfiles.conf @@ -0,0 +1,2 @@ +d /var/lib/units 0755 root root - - +C /var/lib/units/currency.units 0644 root root - /usr/share/units/defaults/currency.units