From d6f1e24b21350343019f1e9ae085956a5259a046 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 1 Mar 2019 12:21:51 +0000 Subject: [PATCH] Accepting request 672763 from home:jengelh:branches:Base:System - Put "sh" under control of update-alternatives (allows doing the same for dash) OBS-URL: https://build.opensuse.org/request/show/672763 OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=273 --- bash.changes | 5 +++++ bash.spec | 53 +++++++++++++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/bash.changes b/bash.changes index 4e0714ca..128f5798 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Feb 8 10:30:17 UTC 2019 - Jan Engelhardt + +- Put "sh" under control of update-alternatives + ------------------------------------------------------------------- Thu Feb 7 15:06:12 UTC 2019 - Dr. Werner Fink diff --git a/bash.spec b/bash.spec index 12059c64..6729e7c8 100644 --- a/bash.spec +++ b/bash.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -20,18 +20,6 @@ %bcond_with sjis Name: bash -BuildRequires: audit-devel -BuildRequires: autoconf -BuildRequires: bison -BuildRequires: fdupes -BuildRequires: makeinfo -BuildRequires: ncurses-devel -BuildRequires: patchutils -BuildRequires: pkg-config -# This has to be always the same version as included in the bash its self -BuildRequires: readline-devel == 8.0 -BuildRequires: screen -BuildRequires: sed %define bextend %nil Version: 5.0 Release: 0 @@ -84,6 +72,19 @@ Patch47: bash-4.3-perl522.patch Patch48: bash-4.3-extra-import-func.patch # PATCH-EXTEND-SUSE Allow root to clean file system if filled up Patch49: bash-4.3-pathtemp.patch +BuildRequires: audit-devel +BuildRequires: autoconf +BuildRequires: bison +BuildRequires: fdupes +BuildRequires: makeinfo +BuildRequires: ncurses-devel +BuildRequires: patchutils +BuildRequires: pkg-config +# This has to be always the same version as included in the bash its self +BuildRequires: readline-devel == 8.0 +BuildRequires: screen +BuildRequires: sed +BuildRequires: update-alternatives %global _sysconfdir /etc %global _incdir %{_includedir} %global _ldldir /%{_lib}/bash @@ -437,15 +438,10 @@ test ${rl1[2]} = ${rl2[2]} || exit 1 rm -rf %{buildroot}/%{_lib}/pkgconfig sed -ri '/CC = gcc/s@(CC = gcc).*@\1@' %{buildroot}%{_libdir}/pkgconfig/bash.pc mkdir -p %{buildroot}/bin - mv %{buildroot}%{_bindir}/bash %{buildroot}/bin/ -%if %_minsh - install sh %{buildroot}/bin/sh - ln -sf ../../bin/sh %{buildroot}%{_bindir}/sh -%else - ln -sf bash %{buildroot}/bin/sh - ln -sf ../../bin/bash %{buildroot}%{_bindir}/sh -%endif - ln -sf ../../bin/bash %{buildroot}%{_bindir}/rbash + ln -sf bash %{buildroot}/%{_bindir}/rbash + ln -s %{_bindir}/bash %{buildroot}/bin/bash + ln -sf bash %{buildroot}/%{_bindir}/sh + ln -s %{_bindir}/sh %{buildroot}/bin/sh install -m 644 COMPAT NEWS %{buildroot}%{_docdir}/%{name} install -m 644 COPYING %{buildroot}%{_docdir}/%{name} install -m 644 doc/FAQ %{buildroot}%{_docdir}/%{name} @@ -482,6 +478,16 @@ EOF %find_lang bash %fdupes -s %{buildroot}%{_datadir}/bash/helpfiles +%post +update-alternatives --force \ + --install "%{_bindir}/sh" sh "%{_bindir}/bash" 100 \ + --slave "/bin/sh" _bin_sh "%{_bindir}/sh" + +%postun +if test "$1" = 0; then + update-alternatives --remove sh "%{_bindir}/bash" +fi + %post doc %install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz @@ -491,7 +497,7 @@ EOF %clean LD_LIBRARY_PATH=%{buildroot}/%{_lib} \ ldd -u -r %{buildroot}/bin/bash || true -%{?buildroot: %{__rm} -rf %{buildroot}} +%{?buildroot: rm -rf %{buildroot}} %files %defattr(-,root,root) @@ -502,6 +508,7 @@ ldd -u -r %{buildroot}/bin/bash || true /bin/bash /bin/sh %dir %{_sysconfdir}/bash_completion.d +%{_bindir}/bash %{_bindir}/bashbug %{_bindir}/rbash %{_bindir}/sh