1 %define bashversion 2.05a
3 Summary: bash-completion offers programmable completion for bash %{bashversion}
6 Group: System Environment/Shells
8 Source0: http://www.caliban.org/files/bash/%{name}-%{version}.tar.bz2
9 URL: http://www.caliban.org/bash/
10 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
12 Requires: bash >= 2.05-7
17 bash-completion is a collection of shell functions that take advantage
18 of the programmable completion feature of bash 2.04 and later.
19 To use this collection, you ideally need bash 2.05a or later
23 %setup -q -n bash_completion
26 rm -rf $RPM_BUILD_ROOT
27 install -d $RPM_BUILD_ROOT%{_sysconfdir}
28 install bash_completion $RPM_BUILD_ROOT%{_sysconfdir}
29 install -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
32 rm -rf $RPM_BUILD_ROOT
35 if ! grep -q '\[ -f '%{_sysconfdir}'/bash_completion \]' \
36 %{_sysconfdir}/bashrc 2>/dev/null; then
37 cat <<'EOF' >> %{_sysconfdir}/bashrc
38 # START bash completion -- do not remove this line
39 bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
40 if [ "$PS1" ] && [ $bmajor -eq 2 ] && [ $bminor '>' 04 ] \
41 && [ -f %{_sysconfdir}/bash_completion ]; then # interactive shell
42 # Source completion code
43 . %{_sysconfdir}/bash_completion
45 unset bash bmajor bminor
46 # END bash completion -- do not remove this line
51 if [ "$1" -eq 0 ]; then
52 sed -e '/^# START bash completion/,/^# END bash completion/d' /etc/bashrc \
54 mv -f /etc/bashrc.tmp /etc/bashrc
58 %defattr(644,root,root,755)
59 %{_sysconfdir}/bash_completion
60 %dir %{_sysconfdir}/bash_completion.d/
61 %doc README Changelog contrib/