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
This commit is contained in:
Dr. Werner Fink 2019-03-01 12:21:51 +00:00 committed by Git OBS Bridge
parent 0e0be74bb2
commit d6f1e24b21
2 changed files with 35 additions and 23 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Feb 8 10:30:17 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Put "sh" under control of update-alternatives
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 7 15:06:12 UTC 2019 - Dr. Werner Fink <werner@suse.de> Thu Feb 7 15:06:12 UTC 2019 - Dr. Werner Fink <werner@suse.de>

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # 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 %bcond_with sjis
Name: bash 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 %define bextend %nil
Version: 5.0 Version: 5.0
Release: 0 Release: 0
@ -84,6 +72,19 @@ Patch47: bash-4.3-perl522.patch
Patch48: bash-4.3-extra-import-func.patch Patch48: bash-4.3-extra-import-func.patch
# PATCH-EXTEND-SUSE Allow root to clean file system if filled up # PATCH-EXTEND-SUSE Allow root to clean file system if filled up
Patch49: bash-4.3-pathtemp.patch 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 _sysconfdir /etc
%global _incdir %{_includedir} %global _incdir %{_includedir}
%global _ldldir /%{_lib}/bash %global _ldldir /%{_lib}/bash
@ -437,15 +438,10 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
rm -rf %{buildroot}/%{_lib}/pkgconfig rm -rf %{buildroot}/%{_lib}/pkgconfig
sed -ri '/CC = gcc/s@(CC = gcc).*@\1@' %{buildroot}%{_libdir}/pkgconfig/bash.pc sed -ri '/CC = gcc/s@(CC = gcc).*@\1@' %{buildroot}%{_libdir}/pkgconfig/bash.pc
mkdir -p %{buildroot}/bin mkdir -p %{buildroot}/bin
mv %{buildroot}%{_bindir}/bash %{buildroot}/bin/ ln -sf bash %{buildroot}/%{_bindir}/rbash
%if %_minsh ln -s %{_bindir}/bash %{buildroot}/bin/bash
install sh %{buildroot}/bin/sh ln -sf bash %{buildroot}/%{_bindir}/sh
ln -sf ../../bin/sh %{buildroot}%{_bindir}/sh ln -s %{_bindir}/sh %{buildroot}/bin/sh
%else
ln -sf bash %{buildroot}/bin/sh
ln -sf ../../bin/bash %{buildroot}%{_bindir}/sh
%endif
ln -sf ../../bin/bash %{buildroot}%{_bindir}/rbash
install -m 644 COMPAT NEWS %{buildroot}%{_docdir}/%{name} install -m 644 COMPAT NEWS %{buildroot}%{_docdir}/%{name}
install -m 644 COPYING %{buildroot}%{_docdir}/%{name} install -m 644 COPYING %{buildroot}%{_docdir}/%{name}
install -m 644 doc/FAQ %{buildroot}%{_docdir}/%{name} install -m 644 doc/FAQ %{buildroot}%{_docdir}/%{name}
@ -482,6 +478,16 @@ EOF
%find_lang bash %find_lang bash
%fdupes -s %{buildroot}%{_datadir}/bash/helpfiles %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 %post doc
%install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz
@ -491,7 +497,7 @@ EOF
%clean %clean
LD_LIBRARY_PATH=%{buildroot}/%{_lib} \ LD_LIBRARY_PATH=%{buildroot}/%{_lib} \
ldd -u -r %{buildroot}/bin/bash || true ldd -u -r %{buildroot}/bin/bash || true
%{?buildroot: %{__rm} -rf %{buildroot}} %{?buildroot: rm -rf %{buildroot}}
%files %files
%defattr(-,root,root) %defattr(-,root,root)
@ -502,6 +508,7 @@ ldd -u -r %{buildroot}/bin/bash || true
/bin/bash /bin/bash
/bin/sh /bin/sh
%dir %{_sysconfdir}/bash_completion.d %dir %{_sysconfdir}/bash_completion.d
%{_bindir}/bash
%{_bindir}/bashbug %{_bindir}/bashbug
%{_bindir}/rbash %{_bindir}/rbash
%{_bindir}/sh %{_bindir}/sh