diff --git a/ghostscript.changes b/ghostscript.changes index 88f3d32..02a2186 100644 --- a/ghostscript.changes +++ b/ghostscript.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Sep 16 08:15:18 UTC 2025 - Dr. Werner Fink + +- Switch over to libalternatives for ghostscript to provide a gs + variant (bsc#1245896) + ------------------------------------------------------------------- Mon Aug 4 07:14:46 UTC 2025 - Johannes Meixner diff --git a/ghostscript.spec b/ghostscript.spec index faa177c..4a18f59 100644 --- a/ghostscript.spec +++ b/ghostscript.spec @@ -23,6 +23,11 @@ %global psuffix %{nil} %bcond_without apparmor %endif +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif Name: ghostscript%{psuffix} Version: 10.05.1 Release: 0 @@ -62,10 +67,15 @@ BuildRequires: libpng-devel BuildRequires: libtiff-devel BuildRequires: libtool BuildRequires: pkgconfig +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else BuildRequires: update-alternatives -BuildRequires: zlib-devel Requires(post): update-alternatives Requires(preun): update-alternatives +%endif +BuildRequires: zlib-devel # Provide the additional RPM Provides of the ghostscript-library package # (ghostscript_x11 is provided by the ghostscript-x11 sub-package, see below). # The "Provides: ghostscript_any" is there to support "BuildRequires: ghostscript_any" @@ -342,10 +352,20 @@ install -D -m 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/apparmor.d/ghostscript %endif # Move /usr/bin/gs to /usr/bin/gs.bin to be able to use update-alternatives -install -d %{buildroot}%{_sysconfdir}/alternatives mv %{buildroot}%{_bindir}/gs %{buildroot}%{_bindir}/gs.bin +%if %{with libalternatives} +mkdir -p %{buildroot}%{_datadir}/libalternatives/gs +ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/gs +cat > %{buildroot}%{_datadir}/libalternatives/gs/10.conf <<-EOF + binary=%{_bindir}/gs.bin + man=gs.1 + group=gs + EOF +%else +install -d %{buildroot}%{_sysconfdir}/alternatives ln -sf %{_bindir}/gs.bin %{buildroot}%{_sysconfdir}/alternatives/gs ln -sf %{_sysconfdir}/alternatives/gs %{buildroot}%{_bindir}/gs +%endif %post /sbin/ldconfig @@ -354,20 +374,30 @@ ln -sf %{_sysconfdir}/alternatives/gs %{buildroot}%{_bindir}/gs %apparmor_reload %{_sysconfdir}/apparmor.d/ghostscript %endif %endif +%if ! %{with libalternatives} %{_sbindir}/update-alternatives \ --install %{_bindir}/gs gs %{_bindir}/gs.bin 15 +%endif %postun -p /sbin/ldconfig +%if ! %{with libalternatives} %preun if test $1 -eq 0 ; then %{_sbindir}/update-alternatives \ --remove gs %{_bindir}/gs.bin fi +%endif %files %license LICENSE +%if %{with libalternatives} +%dir %{_datadir}/libalternatives/ +%dir %{_datadir}/libalternatives/gs/ +%{_datadir}/libalternatives/gs/10.conf +%else %ghost %config %{_sysconfdir}/alternatives/gs +%endif %{_bindir}/dvipdf %{_bindir}/eps2eps %{_bindir}/gs