#!/bin/sh

# Generic Phoronix Test Suite installer

if [ "X$1" = "X" ]
then
	INSTALL_PREFIX="/usr"
else
	INSTALL_PREFIX="$1"
fi

mkdir -p $INSTALL_PREFIX/bin/
mkdir -p $INSTALL_PREFIX/share/phoronix-test-suite/
mkdir -p $INSTALL_PREFIX/share/doc/phoronix-test-suite/

cp CHANGE-LOG $INSTALL_PREFIX/share/doc/phoronix-test-suite/
cp COPYING $INSTALL_PREFIX/share/doc/phoronix-test-suite/

cd documentation/
cp -r * $INSTALL_PREFIX/share/doc/phoronix-test-suite/
cd ..

cp -r pts/ $INSTALL_PREFIX/share/phoronix-test-suite/
rm -f $INSTALL_PREFIX/share/phoronix-test-suite/pts/etc/scripts/package-build-*
cp -r pts-core/ $INSTALL_PREFIX/share/phoronix-test-suite/

sed 's:PTS_DIR=`pwd`:PTS_DIR='"$INSTALL_PREFIX"'\/share\/phoronix-test-suite:g' phoronix-test-suite > $INSTALL_PREFIX/bin/phoronix-test-suite
chmod +x $INSTALL_PREFIX/bin/phoronix-test-suite

echo "Phoronix Test Suite Installed: $INSTALL_PREFIX/bin/phoronix-test-suite"
