Author Topic: Script to install the client on Linux  (Read 520 times)

Taffy

  • Wayfarer
  • *
  • Posts: 3
    • View Profile
Script to install the client on Linux
« on: February 13, 2005, 04:12:35 pm »
I tried the Linux installer but had no luck getting it to create a working installation ... so I spent a good part of yesterday trying to install things by hand (and I wrote a script along the way so that I could repeat it).

This script will download and compile all the source code (as long as you have any necessary programs installed ... it only downloads cal3d, Crystal Space, CEL and Planeshift). After it finishes then you\'ll still have to download the artwork (you can copy the art directory from a previous install attempt to speed up this process). Run the setenv.sh script to set the environment variables, run updater and then start up the client.


Code: [Select]

#!/bin/bash

echo \"Where do you want to install Planeshift? [${HOME}/PS]\"
read INSTALLDIR
if [ -z \"${INSTALLDIR}\" ]
then
   INSTALLDIR=${HOME}/PS
fi
if [ ! -d ${INSTALLDIR} ]
then
    echo \"Creating ${INSTALLDIR}.\"
    mkdir ${INSTALLDIR}
 RETURN=${?}
 if [ ! ${RETURN} = 0 ]
  then
        echo \"Could not create ${INSTALLDIR}.\"
        echo \"Exiting...\"
     exit
    fi
else
  touch ${INSTALLDIR}/write.test 1>/dev/null 2>&1
 RETURN=${?}
 if [ ! ${RETURN} = 0 ]
  then
        echo \"Can not write to ${INSTALLDIR} (permissions problem).\"
      echo \"Exiting...\"
     exit
    fi
  rm -f ${INSTALLDIR}/write.test
fi
cd ${INSTALLDIR}

LOGFILE=${INSTALLDIR}/installer.log

echo \"\"
ANSWER=\"\"
while [ ! \"${ANSWER}\" = \"y\" -a ! \"${ANSWER}\" = \"Y\" -a ! \"${ANSWER}\" = \"n\" -a ! \"${ANSWER}\" = \"N\" ]
do
 echo \"Do you want to download cal3d, Crystal Space, CEL and Planeshift? [y/n]\"
    read ANSWER
done
if [ \"${ANSWER}\" = \"y\" -o \"${ANSWER}\" = \"Y\" ]
then
    echo \"Downloading cal3d...\"
   #cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/cal3d login
 #cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cal3d co cal3d
   wget -nv http://unc.dl.sourceforge.net/sourceforge/cal3d/cal3d-full-0.10.0.tar.bz2 1> ${LOGFILE} 2>&1
   tar -xjf cal3d-full-0.10.0.tar.bz2 >> ${LOGFILE}
    echo \"cal3d done!\"
    echo \"Downloading Crystal Space...\"
   cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/crystal login
    cvs -z3 -Q -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/crystal co CS >> ${LOGFILE}
    echo \"Crystal Space done!\"
    echo \"Downloading CEL...\"
 cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/cel login
    cvs -z3 -Q -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cel co cel >> ${LOGFILE}
   echo \"CEL done!\"
  echo \"Downloading Planeshift...\"
  cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/planeshift login
 cvs -z3 -Q -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/planeshift co planeshift >> ${LOGFILE}
 echo \"Planeshift done!\"
fi

echo \"\"
if [ `whoami` = \"root\" ]
then
  USER=\"\"
   while [ -z \"${USER}\" ]
    do
      echo \"What user do you want to own the Planeshift files?\"
     read USER
   done
    GROUP=\"\"
  while [ -z \"${GROUP}\" ]
   do
      echo \"What group do you want the Planeshift files to belong to?\"
      read GROUP
  done
    if [ -z \"`grep ${GROUP}: /etc/group`\" ]
   then
        echo \"Creating ${GROUP}.\"
     groupadd ${GROUP}
   fi
  if [ -z \"`grep ${USER}: /etc/passwd`\" ]
   then
        echo \"Creating ${USER} user.\"
     useradd -m -G ${GROUP} ${USER}
  fi
else
  echo \"Planeshift will be installed with the current user\'s UID and GID.\"
fi

export LD_LIBRARY_PATH=${INSTALLDIR}/cal3d-0.10.0/lib/:$LD_LIBRARY_PATH
export CRYSTAL=${INSTALLDIR}/CS
export CEL=${INSTALLDIR}/cel
export CSCONFPATH=${INSTALLDIR}/cel

echo \"Compiling cal3d...\"
LIBCAL=${INSTALLDIR}/cal3d-0.10.0
cd ${LIBCAL}
./autogen.sh >> ${LOGFILE}
./configure --prefix=${LIBCAL} >> ${LOGFILE}
make >> ${LOGFILE}
make install >> ${LOGFILE}
echo \"cal3d done!\"

echo \"Compiling Crystal Space...\"
cd ${INSTALLDIR}/CS
./configure --enable-debug  --with-libcal3d=${LIBCAL} >> ${LOGFILE}
jam libs >> ${LOGFILE}
jam plugins >> ${LOGFILE}
jam cs-config >> ${LOGFILE}
echo \"Crystal Space done!\"

echo \"Compiling CEL...\"
cd ${INSTALLDIR}/cel
./configure --enable-debug >> ${LOGFILE}
jam -a >> ${LOGFILE}
echo \"CELL done!\"

echo \"Compiling Planeshift...\"
cd ${INSTALLDIR}/planeshift
./autogen.sh >> ${LOGFILE}
./configure --enable-debug >> ${LOGFILE}
jam -a >> ${LOGFILE}
echo \"Planeshift done!\"

if [ `whoami` = \"root\" ]
then
   chown -R ${USER}:${GROUP} ${INSTALLDIR}
fi

SETENV=${INSTALLDIR}/setenv.sh
echo \"#!/bin/sh\" > ${SETENV}
echo \"export LD_LIBRARY_PATH=${INSTALLDIR}/cal3d-0.10.0/lib/:\\$LD_LIBRARY_PATH\" >> ${SETENV}
echo \"export CRYSTAL=${INSTALLDIR}/CS\" >> ${SETENV}
echo \"export CEL=${INSTALLDIR}/cel\" >> ${SETENV}
echo \"export CSCONFPATH=${INSTALLDIR}/cel\" >> ${SETENV}

echo \"Run \\\". ${INSTALLDIR}/${SETENV}\\\" (that\'s: period space ${INSTALLDIR}/${SETENV}) before starting Planeshift. That will set the correct environment variables. You can also copy those variables to your .bashrc file if you always want them to be set.\"
echo \"Now you just need to get the artwork installed. If you already have the artwork somewhere from an earlier install then copy that art directory to ${INSTALLDIR}/planeshift. Then run the updater application to download any missing files and get the latest updates.\"
echo \"After that you are ready to start playing!\"