summaryrefslogtreecommitdiffstats
path: root/install-sh
blob: 4ae929de7799b6b9166d172773eae37d5743c7d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh

# Phoronix Test Suite
# URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
# Copyright (C) 2008 - 2009, Phoronix Media
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Generic Phoronix Test Suite installer

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

# Ensure the user is in the correct directory
if [ ! -f pts-core/phoronix-test-suite.php ]
then
	cat <<'EOT'

To install the Phoronix Test Suite you must first change directories to phoronix-test-suite/. For support visit: http://www.phoronix-test-suite.com/

EOT
exit
fi

mkdir -p $DESTDIR$INSTALL_PREFIX
if [ ! -w $DESTDIR$INSTALL_PREFIX ]
then
	echo "\nERROR: $DESTDIR$INSTALL_PREFIX is not writable. Run this installer as root or specify a different directory prefix as the first argument sent to this script.\n"
	exit
fi

rm -rf $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
rm -rf $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/

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

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

cd documentation/
cp -r * $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
cd ..
rm -rf $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/man-pages/

cp documentation/man-pages/*.1 $DESTDIR$INSTALL_PREFIX/share/man/man1/

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

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

echo "\nPhoronix Test Suite Installation Completed\n
Executable File: $INSTALL_PREFIX/bin/phoronix-test-suite
Documentation: $INSTALL_PREFIX/share/doc/phoronix-test-suite/
Phoronix Test Suite Files: $INSTALL_PREFIX/share/phoronix-test-suite/\n"
if [ "X$DESTDIR" != "X" ]; then echo "Installed to chroot: $DESTDIR"; fi