-%define bashversion 2.05a
-Summary: bash-completion offers programmable completion for bash %{bashversion}
-Summary(pl): Programowalne uzupe³nianie nazw dla basha %{bashversion}
+Summary: bash-completion offers programmable completion for bash
+Summary(pl.UTF-8): Programowalne uzupełnianie nazw dla basha
Name: bash-completion
-Version: 20020427
-Release: 1
-Group: Applications/Shells
+Version: 20060301
+Release: 3
License: GPL
+Group: Applications/Shells
Source0: http://www.caliban.org/files/bash/%{name}-%{version}.tar.bz2
+# Source0-md5: ed95a89f57357a42b8e4eb95487bf9d0
+Source1: %{name}-poldek.sh
+Source2: %{name}.sh
+Patch0: %{name}-rpm-cache.patch
+Patch1: %{name}-rpm-arch.patch
+Patch2: %{name}-FHS.patch
+Patch3: %{name}-mplayer.patch
URL: http://www.caliban.org/bash/
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+Requires(triggerpostun): sed >= 4.0
+Requires: bash >= 2.05a-3
+Obsoletes: bash-completion-rpm-cache
BuildArch: noarch
-Requires: bash >= %{bashversion}-3
-Requires(post): grep
-Requires(postun): sed
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
bash-completion is a collection of shell functions that take advantage
-of the programmable completion feature of bash 2.04 and later. To use
-this collection, you ideally need bash 2.05a or later.
+of the programmable completion feature of bash 2.04 and later.
-%description -l pl
-bash-completion jest kolekcj± funkcji shella, które opieraj± siê na
-wbudowanych rozszerzeniach basha 2.04 lub pó¼niejszego. Aby u¿ywaæ tej
-kolekcji, potrzebujesz basha 2.05a lub pó¼niejszego.
+%description -l pl.UTF-8
+bash-completion jest kolekcją funkcji shella, które opierają się na
+wbudowanych rozszerzeniach basha 2.04 lub późniejszego umożliwiającego
+kompletowanie parametrów linii poleceń.
%prep
%setup -q -n bash_completion
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_sysconfdir}
-install bash_completion $RPM_BUILD_ROOT%{_sysconfdir}
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/bash_completion.d,/etc/shrc.d,/var/cache}
-gzip -9nf README Changelog
+install bash_completion $RPM_BUILD_ROOT%{_sysconfdir}
+install contrib/* $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
+> $RPM_BUILD_ROOT/var/cache/rpmpkgs.txt
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/poldek
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/shrc.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
-if ! grep -q '\[ -f '%{_sysconfdir}'/bash_completion \]' \
- %{_sysconfdir}/bashrc 2>/dev/null; then
- cat <<'EOF' >> %{_sysconfdir}/bashrc
-# START bash completion -- do not remove this line
-bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
-if [ "$PS1" ] && [ "$bmajor" -eq 2 ] && [ "$bminor" '>' 04 ] \
- && [ -f %{_sysconfdir}/bash_completion ]; then # interactive shell
- # Source completion code
- . %{_sysconfdir}/bash_completion
-fi
-unset bash bmajor bminor
-# END bash completion -- do not remove this line
-EOF
-fi
+if [ ! -f /var/cache/rpmpkgs.txt ]; then
+ touch /var/cache/rpmpkgs.txt
+ chown root:wheel /var/cache/rpmpkgs.txt
+ chmod 664 /var/cache/rpmpkgs.txt
-%postun
-if [ "$1" -eq 0 ]; then
- sed -e '/^# START bash completion/,/^# END bash completion/d' /etc/bashrc \
- > /etc/bashrc.tmp
- mv -f /etc/bashrc.tmp /etc/bashrc
+ # rpm binary check for vservers
+ if [ -x /bin/rpm ]; then
+ export LC_ALL=C
+ rpm -qa --qf '%%{name}-%%{version}-%%{release}.%%{arch}.rpm\n' 2>&1 | sort > /var/cache/rpmpkgs.txt
+ fi
fi
+%triggerpostun -- %{name} < 20050721-3.9
+sed -i -e '/^# START bash completion/,/^# END bash completion/d' /etc/bashrc
+chown root:wheel /var/cache/rpmpkgs.txt
+chmod 664 /var/cache/rpmpkgs.txt
+
%files
%defattr(644,root,root,755)
+%doc README Changelog BUGS
%{_sysconfdir}/bash_completion
-%dir %{_sysconfdir}/bash_completion.d/
-%doc *.gz contrib/
+%{_sysconfdir}/bash_completion.d
+/etc/shrc.d/%{name}.sh
+%ghost %attr(664,root,wheel) /var/cache/rpmpkgs.txt