diff --git a/gswrap.changes b/gswrap.changes index 7f71bd0..5538547 100644 --- a/gswrap.changes +++ b/gswrap.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 16 12:42:08 UTC 2025 - Dr. Werner Fink + +- Switch over to libalternatives for gs.wrap to provide a gs + variant (bsc#1245896) + ------------------------------------------------------------------- Fri Feb 9 12:00:28 UTC 2024 - Dr. Werner Fink diff --git a/gswrap.spec b/gswrap.spec index 991eb1d..d678a2e 100644 --- a/gswrap.spec +++ b/gswrap.spec @@ -1,7 +1,7 @@ # # spec file for package gswrap # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,11 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif Name: gswrap Version: 0.1 Release: 0 @@ -29,9 +34,15 @@ Requires: bubblewrap Requires: coreutils Requires: sed BuildRequires: sed +%if %{with libalternatives} +BuildRequires: alts +Requires(post): alts +Requires(preun): alts +%else BuildRequires: update-alternatives Requires(post): update-alternatives -Requires(preun):update-alternatives +Requires(preun): update-alternatives +%endif BuildArch: noarch %define debug_package %nil @@ -50,11 +61,22 @@ sed -r '/ghostscript=@@GS@@/{s^@@GS@@^/usr/bin/gs.bin^}' < %{S:0} > gs.wrap %install install -d %buildroot%{_bindir} -install -d %buildroot%{_sysconfdir}/alternatives install -m 755 gs.wrap %buildroot%{_bindir}/gs.wrap +%if %{with libalternatives} +mkdir -p %{buildroot}%{_datadir}/libalternatives/gs +ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/gs +cat > %{buildroot}%{_datadir}/libalternatives/gs/20.conf <<-EOF + binary=%{_bindir}/gs.wrap + man=gs.1 + group=gs + EOF +%else +install -d %buildroot%{_sysconfdir}/alternatives ln -sf %{_bindir}/gs.wrap %{buildroot}%{_sysconfdir}/alternatives/gs ln -sf %{_sysconfdir}/alternatives/gs %{buildroot}%{_bindir}/gs +%endif +%if ! %{with libalternatives} %post %{_sbindir}/update-alternatives \ --install %{_bindir}/gs gs %{_bindir}/gs.wrap 100 @@ -64,11 +86,18 @@ if test $1 -eq 0 ; then %{_sbindir}/update-alternatives \ --remove gs %{_bindir}/gs.wrap fi +%endif %files %defattr(-,root,root) %_bindir/gs.wrap %_bindir/gs +%if %{with libalternatives} +%dir %{_datadir}/libalternatives/ +%dir %{_datadir}/libalternatives/gs/ +%{_datadir}/libalternatives/gs/10.conf +%else %ghost %config %{_sysconfdir}/alternatives/gs +%endif %changelog