SPECS/tcsh/tcsh.spec
f4d17450
 # Got the intial spec from Fedora and modified it
ca774cb6
 Summary:        An enhanced version of csh, the C shell
 Name:           tcsh
 Version:        6.20.00
7f9d2e12
 Release:        4%{?dist}
ca774cb6
 License:        BSD
 Group:          System Environment/Shells
 Source:         http://www.sfr-fresh.com/unix/misc/%{name}-%{version}.tar.xz
 %define sha1    tcsh=a52deb0181e32583dbe666474c9c2e784357feba
35771341
 # patch origin http://pkgs.fedoraproject.org/cgit/rpms/tcsh.git/
 Patch0:         tcsh-6.20.00-009-fix-regexp-for-backlash-quoting-tests.patch
ca774cb6
 URL:            http://www.tcsh.org/
 Vendor:         VMware, Inc.
 Distribution:   Photon
 Provides:       csh = %{version}
 Provides:       /bin/tcsh, /bin/csh
 BuildRequires:  ncurses-devel
 Requires:       ncurses
7f9d2e12
 Requires(post): /bin/grep
 Requires(postun): (coreutils or toybox) /bin/grep
f4d17450
 
 %description
 Tcsh is an enhanced but completely compatible version of csh, the C
 shell.  Tcsh is a command language interpreter which can be used both
 as an interactive login shell and as a shell script command processor.
 Tcsh includes a command line editor, programmable word completion,
 spelling correction, a history mechanism, job control and a C language
 like syntax.
 
 %prep
 %setup -q
35771341
 %patch0 -p1
f4d17450
 
 %build
 sed -i -e 's|\$\*|#&|' -e 's|fR/g|&m|' tcsh.man2html &&
 
 %configure --prefix=%{_prefix}
 make %{?_smp_mflags} all
 
 %install
 mkdir -p %{buildroot}%{_mandir}/man1 %{buildroot}%{_bindir}
 install -p -m 755 tcsh %{buildroot}%{_bindir}/tcsh
 install -p -m 644 tcsh.man %{buildroot}%{_mandir}/man1/tcsh.1
 ln -sf tcsh %{buildroot}%{_bindir}/csh
 ln -sf tcsh.1 %{buildroot}%{_mandir}/man1/csh.1
 
 while read lang language ; do
ca774cb6
   dest=%{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES
421d1f6b
   if test -f nls/$language.cat ; then
ca774cb6
     mkdir -p $dest
421d1f6b
     install -p -m 644 nls/$language.cat $dest/tcsh
ca774cb6
     echo "%lang($lang) %{_datadir}/locale/$lang/LC_MESSAGES/tcsh"
   fi
f4d17450
 done > tcsh.lang << _EOF
 de german
 el greek
 en C
 es spanish
 et et
 fi finnish
 fr french
 it italian
 ja ja
 pl pl
 ru russian
 uk ukrainian
 _EOF
 
 %check
35771341
 # tcsh expect nonroot user to run a tests
 chmod g+w . -R
 useradd test -G root -m
 sudo -u test make check && userdel test -r -f
f4d17450
 
 %clean
 rm -rf %{buildroot}
 
 %post
04e27de8
 if [ $1 -eq 1 ] ; then
   if [ ! -f /etc/shells ]; then
    echo "%{_bindir}/tcsh" >> /etc/shells
ca774cb6
    echo "%{_bindir}/csh"  >> /etc/shells
70a51c1b
    echo "/bin/tcsh" >> /etc/shells
ca774cb6
    echo "/bin/csh"  >> /etc/shells
04e27de8
   else
    grep -q '^%{_bindir}/tcsh$' /etc/shells || \
    echo "%{_bindir}/tcsh" >> /etc/shells
    grep -q '^%{_bindir}/csh$'  /etc/shells || \
ca774cb6
    echo "%{_bindir}/csh"  >> /etc/shells
70a51c1b
    grep -q '^/bin/tcsh$' /etc/shells || \
    echo "/bin/tcsh" >> /etc/shells
    grep -q '^/bin/csh$'  /etc/shells || \
ca774cb6
    echo "/bin/csh"  >> /etc/shells
04e27de8
   fi
f4d17450
 fi
 
 %postun
04e27de8
 if [ $1 -eq 0 ] ; then
   if [ ! -x %{_bindir}/tcsh ]; then
    grep -v '^%{_bindir}/tcsh$'  /etc/shells | \
    grep -v '^%{_bindir}/csh$' > /etc/shells.rpm && \
    mv /etc/shells.rpm /etc/shells
   fi
70a51c1b
   if [ ! -x /bin/tcsh ]; then
    grep -v '^/bin/tcsh$'  /etc/shells | \
    grep -v '^/bin/csh$' > /etc/shells.rpm && \
    mv /etc/shells.rpm /etc/shells
   fi
f4d17450
 fi
 
 %files -f tcsh.lang
 %defattr(-,root,root,-)
 %{_bindir}/tcsh
 %{_bindir}/csh
 %{_mandir}/man1/*.1*
 
 %changelog
7f9d2e12
 *   Mon Sep 18 2017 Alexey Makhalov <amakhalov@vmware.com> 6.20.00-4
 -   Requires coreutils or toybox and /bin/grep
35771341
 *   Tue Jun 6 2017 Alexey Makhalov <amakhalov@vmware.com> 6.20.00-3
 -   Fix make check issues.
421d1f6b
 *   Tue Apr 25 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.20.00-2
 -   Ensure non empty debuginfo
ca774cb6
 *   Tue Mar 28 2017 Xiaolin Li <xiaolinl@vmware.com> 6.20.00-1
 -   Updated to version 6.20.00
 *   Tue Feb 07 2017 Divya Thaluru <dthaluru@vmware.com> 6.19.00-6
 -   Added /bin/csh and /bin/tsch entries in /etc/shells
 *   Wed Dec 14 2016 Alexey Makhalov <amakhalov@vmware.com> 6.19.00-5
 -   tcsh.glibc-2.24.patch
 *   Wed May 25 2016 Anish Swaminathan <anishs@vmware.com> 6.19.00-4
 -   Fix calloc for gcc 5 optimization
 *   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.19.00-3
 -   GA - Bump release of all rpms
 *   Wed May 4 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.19.00-2
 -   Fix for upgrade issues
 *   Thu Jan 21 2016 Anish Swaminathan <anishs@vmware.com> 6.19.00-1
 -   Upgrade version
 *   Wed Apr 1 2015 Divya Thaluru <dthaluru@vmware.com> 6.18.01-1
 -   Initial build. First version