#!/bin/sh
# (C) Raphael Langerhorst, August 2004
# see file LICENSE.BSD for the license
if [ -z $G_PREFIX ]
then
G_PREFIX=/usr/local
fi
checkreturn()
{
retvalue=$1
if [ ! $retvalue -eq 0 ]
then
echo ""
echo "Operation failed with error code $retvalue,"
echo "please take a look at the output to see what went wrong."
echo ""
echo "If this is a priviledge problem, be sure you have the"
echo "required privilegdes to install into the desired prefix."
echo ""
echo "If you don't know what to do about the problem, please"
echo "contact the developers. See http://www.g-system.at"
echo "Using the bug mailing list is recommended."
echo ""
exit $retvalue
fi
}
echo ""
echo "Installing G System."
echo "Make sure that the source code is compiled before calling install!"
echo ""
echo "You can set a custom prefix with the environment varaible \"G_PREFIX\"."
echo ""
echo "Prefix is $G_PREFIX"
echo ""
echo "Checking for \"install\"".
which install
if [ $? -eq 0 ]
then
echo "\"install\" found."
echo ""
else
echo "\"install\" was not found on your system,"
echo "please make sure it is in your path!"
exit 1
fi
sleep 1
mkdir -p $G_PREFIX
mkdir -p $G_PREFIX/lib
echo "Installing libraries into $G_PREFIX/lib"
current_dir=$PWD
cd ./lib
for i_file in ./*
do
install -p $i_file $G_PREFIX/lib
checkreturn $?
done
cd $current_dir
mkdir -p $G_PREFIX/include/G
echo "Installing headers into $G_PREFIX/include/G"
cd ./src
for i_dir in core worldengine basicelements clientengine
do
last_dir=$PWD
cd $i_dir
for i_file in ./*.h
do
install -p $i_file $G_PREFIX/include/G
checkreturn $?
done
cd $last_dir
done
cd $current_dir
mkdir -p $G_PREFIX/bin
echo "Installing binaries into $G_PREFIX/bin"
cd ./bin
for i_file in ./*
do
install -p $i_file $G_PREFIX/bin
checkreturn $?
done
cd $current_dir
if [ -z $G_NO_INST_DOCS ]
then
echo "Installing documentation into $G_PREFIX/share/doc/gsystem"
mkdir -p $G_PREFIX/share/doc/gsystem
cp -r ./doc/gdocs/* $G_PREFIX/share/doc/gsystem
checkreturn $?
else
echo "Not installing documentation."
fi
username=`whoami`
if [ $username = "root" ]
then
echo ""
echo "Updating linker cache with \"ldconfig\""
echo ""
ldconfig
checkreturn $?
else
echo ""
echo "Please run ldconfig manually to make sure the"
echo "installed libraries are available."
echo ""
fi
echo ""
echo "Installation completed successfully!"
echo "The G System is now installed in $G_PREFIX"
echo ""
echo "Please report bugs or comments to the mailing lists or forum."
echo ""
echo "Take a look at the README file to find out how to use the G System."
echo ""
echo "ENJOY!!"
echo ""
exit 0
syntax highlighted by Code2HTML, v. 0.9.1