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