diff --git a/groff.spec b/groff.spec index df943c7d27b9e413a1560229d140f9695e19eb98..e0b3e61259a8e7c61c2a95fa624794efec5bebc4 100644 --- a/groff.spec +++ b/groff.spec @@ -2,7 +2,7 @@ %{!?with_x:%global with_x 1} Name: groff Version: 1.23.0 -Release: 1 +Release: 2 Summary: A typesetting system License: GPLv3+ and GFDL and BSD and MIT URL: http://www.gnu.org/software/groff/ @@ -87,6 +87,12 @@ done %install %make_install +#rename files for alternative usage +mv %{buildroot}%{_bindir}/soelim %{buildroot}%{_bindir}/soelim.%{name} +touch %{buildroot}%{_bindir}/soelim +mv %{buildroot}%{_mandir}/man1/soelim.1 %{buildroot}%{_mandir}/man1/soelim.%{name}.1 +touch %{buildroot}%{_mandir}/man1/soelim.1 + # some binaries need alias with 'g' or 'z' prefix for file in g{nroff,troff,tbl,pic,eqn,neqn,refer,lookbib,indxbib,soelim} zsoelim; do ln -s ${file#?} %{buildroot}%{_bindir}/${file} @@ -130,6 +136,29 @@ make check %postun +%pre base +# remove alternativized files if they are not symlinks +[ -L %{_bindir}/soelim ] || %{__rm} -f %{_bindir}/soelim >/dev/null 2>&1 || : +[ -L %{_mandir}/man1/soelim.1.gz ] || %{__rm} -f %{_mandir}/man1/soelim.1.gz >/dev/null 2>&1 || : + +%post base +# set up the alternatives files +%{_sbindir}/update-alternatives --install %{_bindir}/soelim soelim %{_bindir}/soelim.%{name} 300 \ + --slave %{_mandir}/man1/soelim.1.gz soelim.1.gz %{_mandir}/man1/soelim.%{name}.1.gz \ + >/dev/null 2>&1 || : + +%preun base +if [ $1 -eq 0 ]; then + %{_sbindir}/update-alternatives --remove soelim %{_bindir}/soelim.%{name} >/dev/null 2>&1 || : +fi + +%postun base +if [ $1 -ge 1 ]; then + if [ "$(readlink %{_sysconfdir}/alternatives/soelim)" == "%{_bindir}/soelim.%{name}" ]; then + %{_sbindir}/update-alternatives --set soelim %{_bindir}/soelim.%{name} >/dev/null 2>&1 || : + fi +fi + %files %defattr(-,root,root) %{_datadir}/%{name}/%{version}/font/devX*/ @@ -279,7 +308,7 @@ make check %{_bindir}/post-grohtml %{_bindir}/pre-grohtml %{_bindir}/preconv -%{_bindir}/soelim +%{_bindir}/soelim.%{name} %{_bindir}/tbl %{_bindir}/troff %{_bindir}/gnroff @@ -291,6 +320,7 @@ make check %{_bindir}/gsoelim %{_bindir}/zsoelim %{_libdir}/groff/ +%ghost %{_bindir}/soelim %if %{with_x} %files x11 @@ -316,6 +346,9 @@ make check %{_infodir}/groff.info* %changelog +* Mon Jul 24 2023 lilong - 1.23.0-2 +- Fix crash when mandoc install + * Tue Jul 18 2023 dillon chen - 1.23.0-1 - update to 1.23.0