From 370e7152bca4d899d5f9a3e644a41ecad1ecaa97 Mon Sep 17 00:00:00 2001 From: Dominic Hopf Date: Jul 03 2014 10:13:38 +0000 Subject: improve handling of /etc/shells --- diff --git a/zsh.spec b/zsh.spec index b4abd4d..25e0cbb 100644 --- a/zsh.spec +++ b/zsh.spec @@ -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 [ ! -f %{_sysconfdir}/shells ] ; then - echo "%{_bindir}/zsh" > %{_sysconfdir}/shells -else - grep -q "^%{_bindir}/zsh$" %{_sysconfdir}/shells || echo "%{_bindir}/zsh" >> %{_sysconfdir}/shells +if [ "$1" = 1 ]; then + if [ ! -f %{_sysconfdir}/shells ] ; then + echo "%{_bindir}/%{name}" > %{_sysconfdir}/shells + echo "/bin/%{name}" >> %{_sysconfdir}/shells + else + 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 - 5.0.5-5 +- improve handling of /etc/shells + * Wed Jul 02 2014 Dominic Hopf - 5.0.5-4 - fix FTBFS issue (RHBZ#1106713) - remove individual _bindir setting; install to /usr/bin/ (RHBZ#1034060)