Summary: GNU Bourne Again Shell (bash)
Name: bash
Version: 2.01
Release: 1
Group: Shells
Copyright: GPL
Source0: ftp://prep.ai.mit.edu/pub/gnu/bash-2.01.tar.gz
Prereq: fileutils grep 
BuildRoot: /var/tmp/bash-root

%changelog


%description
Bash is an sh-compatible command language interpreter that
executes commands read from the standard input or from a
file.  Bash also incorporates useful features from the
Korn and C shells (ksh and csh).

Bash is ultimately intended to be a conformant implementation
of the IEEE Posix Shell and Tools specification (IEEE
Working Group 1003.2).

%prep
%setup

%build
./configure
make "CFLAGS=$RPM_OPT_FLAGS" LDFLAGS=-s prefix=/usr CC=gcc CPPNAME='$(CC) -E'
strip bash

%install
make prefix=$RPM_BUILD_ROOT/usr install
mkdir -p $RPM_BUILD_ROOT/bin $RPM_BUILD_ROOT/etc
mv $RPM_BUILD_ROOT/usr/bin/bash $RPM_BUILD_ROOT/bin/bash
rm -f $RPM_BUILD_ROOT/usr/bin/installed-bash
gzip -9nf $RPM_BUILD_ROOT/usr/info/bash.info
rm -f $RPM_BUILD_ROOT/usr/bin/bash.old
install -m644 $RPM_SOURCE_DIR/bashrc $RPM_BUILD_ROOT/etc/bashrc
ln -sf bash.1 $RPM_BUILD_ROOT/usr/man/man1/sh.1
ln -sf bash $RPM_BUILD_ROOT/bin/sh

%clean
rm -rf $RPM_BUILD_ROOT

# ***** bash doesn't use install-info. It's always listed in /usr/info/dir
# to prevent prereq loops
%post
if [ ! -f /etc/shells ]; then
	echo "/bin/bash" > /etc/shells
	echo "/bin/sh" >> /etc/shells
else
	if ! grep '^/bin/bash$' /etc/shells > /dev/null; then
		echo "/bin/bash" >> /etc/shells
	fi
	if ! grep '^/bin/sh$' /etc/shells > /dev/null; then
		echo "/bin/sh" >> /etc/shells
	fi
fi

%postun
if [ "$1" = "0" ]; then
	grep -v /bin/bash /etc/shells | grep -v /bin/sh > /etc/shells.new
	mv /etc/shells.new /etc/shells
fi

%files
%doc NEWS README RELEASE
%config /etc/bashrc
/bin/bash
/bin/sh
/usr/info/bash.info.gz
/usr/man/man1/bash.1
/usr/man/man1/sh.1
/usr/bin/bashbug