pts-core: Just mention PHP 5.3 as the new base requirement. Code still should largely...
[phoronix-test-suite.git] / install-sh
blob760f0020a2bbaed7c8e793a8abed0750f6c52c02
1 #!/bin/sh
3 # Phoronix Test Suite
4 # URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
5 # Copyright (C) 2008 - 2015, Phoronix Media
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Generic Phoronix Test Suite installer
22 # To install into a chroot, set $DESTDIR to the corresponding directory.
24 if [ "X$1" = "X" ]
25 then
26 INSTALL_PREFIX="/usr"
27 else
28 INSTALL_PREFIX="$1"
31 # Ensure the user is in the correct directory
32 if [ ! -f pts-core/phoronix-test-suite.php ]
33 then
34 cat <<'EOT'
36 To install the Phoronix Test Suite you must first change directories to phoronix-test-suite/. For support visit: http://www.phoronix-test-suite.com/
38 EOT
39 exit
42 mkdir -p $DESTDIR$INSTALL_PREFIX
43 if [ ! -w $DESTDIR$INSTALL_PREFIX ]
44 then
45 echo "ERROR: $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."
46 exit
49 rm -rf $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
50 rm -rf $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
52 mkdir -p $DESTDIR$INSTALL_PREFIX/bin/
53 mkdir -p $DESTDIR$INSTALL_PREFIX/share/appdata/
54 mkdir -p $DESTDIR$INSTALL_PREFIX/share/applications/
55 mkdir -p $DESTDIR$INSTALL_PREFIX/share/icons/hicolor/48x48/apps/
56 mkdir -p $DESTDIR$INSTALL_PREFIX/share/man/man1/
57 mkdir -p $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
58 mkdir -p $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
59 mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/bash_completion.d/
60 #mkdir -p $DESTDIR$INSTALL_PREFIX/../usr/lib/systemd/system/
61 #mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/init/
63 cp ChangeLog $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
64 cp COPYING $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
65 cp AUTHORS $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
67 cd documentation/
68 cp -r * $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
69 cd ..
70 rm -rf $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/man-pages/
72 cp documentation/man-pages/*.1 $DESTDIR$INSTALL_PREFIX/share/man/man1/
73 cp pts-core/static/bash_completion $DESTDIR$INSTALL_PREFIX/../etc/bash_completion.d/phoronix-test-suite
74 cp pts-core/static/images/phoronix-test-suite.png $DESTDIR$INSTALL_PREFIX/share/icons/hicolor/48x48/apps/phoronix-test-suite.png
75 cp pts-core/static/phoronix-test-suite.desktop $DESTDIR$INSTALL_PREFIX/share/applications/
76 cp pts-core/static/phoronix-test-suite-launcher.desktop $DESTDIR$INSTALL_PREFIX/share/applications/
77 cp pts-core/static/phoronix-test-suite.appdata.xml $DESTDIR$INSTALL_PREFIX/share/appdata/
79 mkdir -p $DESTDIR$INSTALL_PREFIX/../usr/lib/systemd/system/
80 cp deploy/*-systemd/*.service $DESTDIR$INSTALL_PREFIX/../usr/lib/systemd/system/
82 # mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/init/
83 # cp pts-core/static/upstart/*.conf $DESTDIR$INSTALL_PREFIX/../etc/init/
85 rm -rf $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core
86 cp -r pts-core $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
87 cp -r deploy $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
88 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/phoronix-test-suite.desktop
89 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/phoronix-test-suite-launcher.desktop
90 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/openbenchmarking.org/openbenchmarking-mime.xml
91 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/bash_completion
92 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/images/openbenchmarking.png
93 rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/images/%phoronix-test-suite.png
96 sed 's:PTS_DIR=`pwd`:PTS_DIR='"$INSTALL_PREFIX"'\/share\/phoronix-test-suite:g' phoronix-test-suite > $DESTDIR$INSTALL_PREFIX/bin/phoronix-test-suite
97 chmod +x $DESTDIR$INSTALL_PREFIX/bin/phoronix-test-suite
99 # sed 's:\$url = PTS_PATH . \"documentation\/index.html\";:\$url = \"'"$INSTALL_PREFIX"'\/share\/doc\/packages\/phoronix-test-suite\/index.html\";:g' pts-core/commands/gui_gtk.php > $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/commands/gui_gtk.php
101 # XDG MIME OpenBenchmarking support
102 if [ "X$DESTDIR" = "X" ] && which xdg-mime >/dev/null && which xdg-icon-resource >/dev/null
103 then
104 #No chroot
105 xdg-mime install pts-core/openbenchmarking.org/openbenchmarking-mime.xml
106 xdg-icon-resource install --context mimetypes --size 64 pts-core/static/images/openbenchmarking.png application-x-openbenchmarking
107 else
108 #chroot
109 mkdir -p $DESTDIR$INSTALL_PREFIX/share/mime/packages/
110 mkdir -p $DESTDIR$INSTALL_PREFIX/share/icons/hicolor/64x64/mimetypes/
111 cp pts-core/openbenchmarking.org/openbenchmarking-mime.xml $DESTDIR$INSTALL_PREFIX/share/mime/packages/
112 cp pts-core/static/images/openbenchmarking.png $DESTDIR$INSTALL_PREFIX/share/icons/hicolor/64x64/mimetypes/application-x-openbenchmarking.png
116 echo -e "\nPhoronix Test Suite Installation Completed\n
117 Executable File: $INSTALL_PREFIX/bin/phoronix-test-suite
118 Documentation: $INSTALL_PREFIX/share/doc/phoronix-test-suite/
119 Phoronix Test Suite Files: $INSTALL_PREFIX/share/phoronix-test-suite/\n"
121 if [ "X$DESTDIR" != "X" ]
122 then
123 echo "Installed to chroot: $DESTDIR"
124 echo "Please update your desktop and mime-database manually"