improve handling of /etc/shells

This commit is contained in:
Dominic Hopf 2014-07-03 12:13:38 +02:00
parent 536e457667
commit 370e7152bc

View File

@ -3,7 +3,7 @@
Summary: Powerful interactive shell
Name: zsh
Version: 5.0.5
Release: 4%{?dist}
Release: 5%{?dist}
License: MIT
URL: http://zsh.sourceforge.net/
Group: System Environment/Shells
@ -128,10 +128,13 @@ sed -i "s!$RPM_BUILD_ROOT%{_datadir}/%{name}/%{version}/help!%{_datadir}/%{name}
rm -rf $RPM_BUILD_ROOT
%post
if [ "$1" = 1 ]; then
if [ ! -f %{_sysconfdir}/shells ] ; then
echo "%{_bindir}/zsh" > %{_sysconfdir}/shells
echo "%{_bindir}/%{name}" > %{_sysconfdir}/shells
echo "/bin/%{name}" >> %{_sysconfdir}/shells
else
grep -q "^%{_bindir}/zsh$" %{_sysconfdir}/shells || echo "%{_bindir}/zsh" >> %{_sysconfdir}/shells
grep -q "^%{_bindir}/%{name}$" %{_sysconfdir}/shells || echo "%{_bindir}/%{name}" >> %{_sysconfdir}/shells
grep -q "^/bin/%{name}$" %{_sysconfdir}/shells || echo "/bin/%{name}" >> %{_sysconfdir}/shells
fi
if [ -f %{_infodir}/zsh.info.gz ]; then
@ -140,7 +143,6 @@ if [ -f %{_infodir}/zsh.info.gz ]; then
--entry="* zsh: (zsh). An enhanced bourne shell."
fi
:
%preun
if [ "$1" = 0 ] ; then
@ -150,18 +152,14 @@ if [ "$1" = 0 ] ; then
--entry="* zsh: (zsh). An enhanced bourne shell."
fi
fi
:
%postun
if [ "$1" = 0 ] ; then
if [ -f %{_sysconfdir}/shells ] ; then
TmpFile=`%{_bindir}/mktemp /tmp/.zshrpmXXXXXX`
grep -v '^%{_bindir}/zsh$' %{_sysconfdir}/shells > $TmpFile
cp -f $TmpFile %{_sysconfdir}/shells
rm -f $TmpFile
fi
if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
sed -i '\!^%{_bindir}/%{name}$!d' %{_sysconfdir}/shells
sed -i '\!^/bin/%{name}$!d' %{_sysconfdir}/shells
fi
%files
%defattr(-,root,root)
%doc README LICENCE Etc/BUGS Etc/CONTRIBUTORS Etc/FAQ FEATURES MACHINES
@ -179,6 +177,9 @@ fi
%doc Doc/*.html
%changelog
* Thu Jul 03 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-5
- improve handling of /etc/shells
* Wed Jul 02 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-4
- fix FTBFS issue (RHBZ#1106713)
- remove individual _bindir setting; install to /usr/bin/ (RHBZ#1034060)