filelist='cows'
usethisperl=/usr/bin/perl
PREFIX=$INSTALL_ROOT/usr

echo Okay, time to install this puppy.

echo s,%BANGPERL%,!$usethisperl,\; > install.pl
echo s,%PREFIX%,$PREFIX,\; >> install.pl
set -x
mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin)
$usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay
chmod a+x $PREFIX/bin/cowsay
ln -s cowsay $PREFIX/bin/cowthink
mkdir -p $PREFIX/share/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/man; mkdir $PREFIX/share/man/man1)
$usethisperl -p install.pl cowsay.1 > $PREFIX/share/man/man1/cowsay.1
chmod a+r $PREFIX/share/man/man1/cowsay.1
ln -s cowsay.1 $PREFIX/share/man/man1/cowthink.1
mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows)
tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -)
set +x

echo Installation complete!  Enjoy the cows!
