Package init

This commit is contained in:
overweight 2019-09-30 11:18:15 -04:00
commit f07153d5b4
2 changed files with 100 additions and 0 deletions

BIN
tcsh-6.21.00.tar.gz Normal file

Binary file not shown.

100
tcsh.spec Normal file
View File

@ -0,0 +1,100 @@
Name: tcsh
Version: 6.21.00
Release: 1
Summary: C shell with file name completion and command line editing
License: BSD
URL: http://www.tcsh.org/
Source0: %{name}-%{version}.tar.gz
BuildRequires: gettext-devel ncurses-devel autoconf
Requires(post): coreutils grep
Requires(postun): sed
Provides: /bin/csh /bin/tcsh
Provides: csh = %{version}
%description
Tcsh is an enhanced but completely compatible version of the Berkeley
C-Shell, with the addition of a command line editor, command and file
name completion, listing, etc., and a bunch of small additions to the
shell itself.
%package help
Summary: help document for tcsh
BuildArch: noarch
%description help
help document for tcsh.
%prep
%autosetup -p1
%build
%configure
%make_build all
%install
%make_install
gzip $RPM_BUILD_ROOT%{_mandir}/man1/tcsh.1
rm -f $RPM_BUILD_ROOT%{_bindir}/tcsh.old
ln -sf tcsh $RPM_BUILD_ROOT%{_bindir}/csh
ln -sf tcsh.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/csh.1.gz
localedir="$RPM_BUILD_ROOT%{_datadir}/locale";
for lang in $(ls $localedir); do
if [ -d $localedir/$lang ]; then
dir="$localedir/$lang/LC_MESSAGES"
if [[ -f "$dir/tcsh.cat" ]]; then
mv $dir/tcsh.cat $dir/tcsh
echo "%lang($lang) %{_datadir}/locale/$lang/LC_MESSAGES/tcsh"
fi
fi
done > %{name}.lang
%check
%make_build check
%pre
%preun
%post
if [[ "$1" -eq 1 ]]; then
if [[ ! -f %{_sysconfdir}/shells ]]; then
echo "/bin/csh" >> %{_sysconfdir}/shells
echo "/bin/tcsh" >> %{_sysconfdir}/shells
echo "%{_bindir}/csh" >> %{_sysconfdir}/shells
echo "%{_bindir}/tcsh" >> %{_sysconfdir}/shells
else
grep -q "^/bin/csh$" %{_sysconfdir}/shells || echo "/bin/csh" >> %{_sysconfdir}/shells
grep -q "^/bin/tcsh$" %{_sysconfdir}/shells || echo "/bin/tcsh" >> %{_sysconfdir}/shells
grep -q "^%{_bindir}/csh$" %{_sysconfdir}/shells || echo "%{_bindir}/csh" >> %{_sysconfdir}/shells
grep -q "^%{_bindir}/tcsh$" %{_sysconfdir}/shells || echo "%{_bindir}/tcsh" >> %{_sysconfdir}/shells
fi
fi
%postun
if [[ "$1" -eq 0 && -f %{_sysconfdir}/shells ]]; then
sed -i -e '\!^/bin/csh$!d' %{_sysconfdir}/shells
sed -i -e '\!^/bin/tcsh$!d' %{_sysconfdir}/shells
sed -i -e '\!^%{_bindir}/csh$!d' %{_sysconfdir}/shells
sed -i -e '\!^%{_bindir}/tcsh$!d' %{_sysconfdir}/shells
fi
%files -f %{name}.lang
%defattr(-,root,root)
%doc Copyright FAQ Fixes README.md complete.tcsh
%{_bindir}/tcsh
%{_bindir}/csh
%files help
%defattr(-,root,root)
%{_mandir}/man1/*.1*
%changelog
* Wed Sep 04 2019 Huiming Xue <xiehuiming@huawei.com> - 6.21.00.1
- modify spec file
* Tue Sep 03 2019 Huiming Xue <xiehuiming@huawei.com> - 6.20.00.11
- Package init