--- INSTALL 2014-11-30 16:13:52.283663538 +0100 +++ INSTALL.new 2014-11-30 16:20:28.087973434 +0100 @@ -1,15 +1,20 @@ #!/bin/bash -BINDIR=/usr/bin -DOCDIR=/usr/share/doc/collectl-utils -SHRDIR=/usr/share/collectl +if [ _"$PREFIX" = _"" ]; then + echo "Installing under $PREFIX" +else + echo "Installing under /" +fi +BINDIR=$PREFIX/usr/bin +DOCDIR=$PREFIX/usr/share/doc/collectl-utils +SHRDIR=$PREFIX/usr/share/collectl mkdir -p $DOCDIR mkdir -p $SHRDIR mkdir -p $SHRDIR/plotfiles mkdir -p $SHRDIR/util -cp colplot.conf /etc +cp colplot.conf $PREFIX/etc cp colplot colmux $BINDIR cp GPL ARTISTIC $DOCDIR @@ -21,11 +26,11 @@ cp tiny.ph oneperpage.ph $SHRDIR cp colplot-apache.conf $SHRDIR cp plotfiles/* $SHRDIR/plotfiles -cp man1/*.1* /usr/share/man/man1 +cp man1/*.1* $PREFIX/usr/share/man/man1 # compress any uncompressed man pages -gzip $RPM_BUILD_ROOT/usr/share/man/man1/colmux.1 -gzip $RPM_BUILD_ROOT/usr/share/man/man1/colplot.1 +gzip $PREFIX/usr/share/man/man1/colmux.1 +gzip $PREFIX/usr/share/man/man1/colplot.1 # D e a l W i t h A p a c h e @@ -33,29 +38,40 @@ # let's just maximize flexibilityby defining distro specific parameters ctl='' apache2=0 -www='/var/www/html' +www="$PREFIX/var/www/html" +link="../../../" if [ -f /usr/sbin/apachectl ] || [ -f /usr/sbin/apache2ctl ]; then if [ -f /usr/sbin/apache2ctl ]; then apache2=1 fi if [ -f /etc/redhat-release ]; then - www=/var/www/html + www=$PREFIX/var/www/html + link="../../../" ctl=/usr/sbin/apachectl - confd=/etc/httpd/conf.d + confd=$PREFIX/etc/httpd/conf.d fi if [ -f /etc/SuSE-release ]; then - www=/srv/www/htdocs + www=$PREFIX/srv/www/htdocs + link="../../../" ctl=/usr/sbin/apache2ctl - confd=/etc/apache2/conf.d + confd=$PREFIX/etc/apache2/conf.d + fi + + if [ -f /etc/mageia-release ]; then + www=$PREFIX/var/www/html + link="../../../" + ctl=/usr/sbin/apachectl + confd=$PREFIX/etc/httpd/conf/sites.d fi if [ -f /etc/debian_version ]; then - www=/var/www/ + www=$PREFIX/var/www/ + link="../../" ctl=/usr/sbin/apachectl - confd=/etc/apache2/sites-available - conf2=/etc/apache2/sites-enabled + confd=$PREFIX/etc/apache2/sites-available + conf2=$PREFIX/etc/apache2/sites-enabled fi else echo "apache not installed, either install it or manually configure colplot" @@ -71,9 +87,9 @@ # Build some symlinks to these echo "building symlinks in $www/colplot" cd $www/colplot -ln -sf $BINDIR/colplot index.cgi -ln -sf $DOCDIR/colplot-help.html -ln -sf $DOCDIR/FAQ-colplot.html +ln -sf `echo $BINDIR | perl -pe "s|$PREFIX|$link/..|"`/colplot index.cgi +ln -sf `echo $DOCDIR | perl -pe "s|$PREFIX|$link/..|"`/colplot-help.html +ln -sf `echo $DOCDIR | perl -pe "s|$PREFIX|$link/..|"`/FAQ-colplot.html if [ "$ctl" = "" ] then @@ -85,6 +101,9 @@ echo "configuring apache to run colplot..." if [ ! -e $confd/colplot.conf ]; then echo "copying $SHRDIR/colplot-apache.conf to $confd/colplot.conf" + if [ ! -d $confd ]; then + mkdir -p $confd + fi cp $SHRDIR/colplot-apache.conf $confd/colplot-apache.conf fi