Author Topic: Automated Installer for Linux  (Read 4021 times)

hybrasyl

  • Traveller
  • *
  • Posts: 12
    • View Profile
Automated Installer for Linux
« on: January 04, 2005, 02:03:31 am »
Below is a script that you can use to install Planeshift on nearly any linux box.  
Just copy/paste it into an empty text document, save as ps-installer.sh or some such thing, then make sure to chmod a+x the file.

Please enjoy!

Code: [Select]

#!/bin/sh
# \\
exec expect -- \"$0\" ${1+\"$@\"}

## Planeshift installer for linux v2.0 (C)2005 by Hybrasyl
## Licensed GPL etc and so forth, so if it breaks your computer don\'t cry, just fix it


###TODO fix this script so it you can run it without being root
###NOTE: Commented areas are due to bug in the expect sudo combination requiring a work around

##This script has only been tested on SuSE 9.2 and appears to do it\'s job without problems

set setupdir \"~/planeshift\"
set installdir \"/opt\"
set password \"\"
set tout 60
set addvars \"TRUE\"

send_user \"\\n\\nThis program automatically installs Planeshift to your computer\\n\"
send_user \"It\'s the next best thing to a universal RPM for Planeshift so enjoy!\\n\\n\"
send_user \"If you are unsure about what this program does or how it does it, plese READ THE SOURCE!\\n\\n\\n\"
send_user \"This program must be run as ROOT if you are not root please exit now!\\n\\n\"
send_user \"For all entries the directories must already exist\\nThis will hopefully be fixed in the next release\\n\"
send_user \"Please make sure to leave off trailing slashes these will be automatically added for you\\n\"
send_user \"When entering information please note that the defaults are sufficient for MOST OS\'s change them only if needed\\n\\n\"
send_user \"Please enter the directory you want to download to (DEFAULT is $setupdir)\\n\"
send_tty \"$setupdir: \"
set timeout $tout
expect \"\\n\" {
    set raw $expect_out(buffer)
    set setupdir2 [string trimright \"$raw\" \"\\n\"]
    if {$setupdir2 != \"\"} {
       set $setupdir $setupdir2
   }
}

send_user \"Please enter the directory you want to install to (DEFAULT is $installdir)\\n\"
send_tty \": \"
set timeout $tout
expect \"\\n\" {
    set raw $expect_out(buffer)
    set installdir2 [string trimright \"$raw\" \"\\n\"]
    if {$installdir2 != \"\"} {
     set $installdir $installdir2
   }
}

send_user \"Would you like me to add the needed environment variables to your bashrc script?\\n\"
send_user \"(HINT:  If you have used this script before then type NO)\\n\"
send_tty \": \"
set timeout $tout
expect \"\\n\" {
    set raw $expect_out(buffer)
    set addvars2 [string trimright \"$raw\" \"\\n\"]
    if {$addvars2 != \"\"} {
     set $addvars $addvars2
   }
}

#send_user \"To proceed with the install please enter the password for the root user\\n\"
#send_user \"Please note that if you leave this blank you will have to log in as root and run make install in each directory\"
#send_tty \"$password: \"
#set timeout $tout
#expect \"\\n\" {
#    set raw $expect_out(buffer)
#    set password [string trimright \"$raw\" \"\\n\"]
#   }

#exec mkdir $installdir
#exec mkdir $setupdir

cd $setupdir
send_user \"Changed to $setupdir\\n\"

##Cal 3D
spawn cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cal3d login
expect \"CVS password: \"
send \"\\n\"
expect eof
spawn cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cal3d co cal3d
expect eof

##Crystal Space
spawn cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/crystal login
expect \"CVS password: \"
send \"\\n\"
expect eof
spawn cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/crystal co CS
expect eof

##CEL
spawn cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cel login
expect \"CVS password: \"
send \"\\n\"
expect eof
spawn cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cel co cel
expect eof

##Planeshift
spawn cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/planeshift login
expect \"CVS password: \"
send \"\\n\"
expect eof
spawn cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/planeshift co planeshift
expect eof

##Install Routines
##Cal 3D
send_user \"Beginning Compile of Cal 3D\\n\"
cd $setupdir/cal3d
spawn ./autogen.sh
expect eof
spawn ./configure  --prefix=$installdir/cal3d
expect eof
spawn ./make
expect eof
#if {$password !=\"\"}{
   send_user \"Installing Cal 3D\\n\"
   #spawn sudo make install
    #expect \"Password: \"
  #set timeout $tout
  #send \"$password\\n\"
    spawn make install
  expect eof
  exec export LD_LIBRARY_PATH=$install/cal3d/lib:$LD_LIBRARY_PATH
#}

##CS
send_user \"Beginning Compile of Crystal Space\\n\"
exec cd $setupdir/CS
spawn ./autogen.sh
expect eof
spawn ./configure --with-libcal3d=$installdir/cal3d --enable-new-renderer
expect eof
spawn jam
expect eof
#if {$password !=\"\"}{
 send_user \"Installing Crystal Space\\n\"
 #spawn sudo make install
    #expect \"Password: \"
  #set timeout $tout
  #send \"$password\\n\"
    spawn make install
  expect eof
  exec export CRYSTAL=$installdir/CS
#}

##CEL
cd $setupdir/cel
exec export CSCONFPATH=$installdir/cel/
spawn ./configure --disable-jamtest --enable-new-renderer
expect eof
spawn jam
expect eof
exec export CEL=$installdir/cel/

##Planeshift
cd $setupdir/planeshift
spawn ./autogen.sh
expect eof
spawn ./configure --enable-new-renderer
expect eof
spawn jam -aq
expect eof

##Set .bashrc environment variables
if ($addvars == \"TRUE\"){
   send_user \"Adding environment variables to ~/.bashrc\\n\"
    exec echo\"export HOME=$installdir/planeshift\" >> ~/.bashrc
    exec echo\"export LD_LIBRARY_PATH=$installdir/cal3d/lib:$LD_LIBRARY_PATH\" >> ~/.bashrc
 exec echo\"export CRYSTAL=$installdir/CS\" >> ~/.bashrc
 exec echo\"export CEL=$installdir/cel/\" >> ~/.bashrc
}

send_user \"Install Completed successfully!\\n\"
send_user \"You must now obtain the artwork using the updater unfortunately at this time it is a manual process\\n\"
send_user \"Download\\n\"
send_user \"http://laanx.fragnetics.com/updater_hidden/root/updaterconfig.xml\\n\"
send_user \"user: psteam\\n\"
send_user \"pass: p1ane\\n\"
send_user \"replace updaterconfig.xml in your planeshift dir with the downloaded one.\\n\"
send_user \"To get the laanx server into the server list do the following:\\n\"
send_user \"cd $installdir/planeshift\\n\"
send_user \"Edit the data/servers.xml file with a text editor\\n\"
send_user \"change the file to the following\\n\"
send_user \"\\n\"
send_user \"\\n\"
send_user \"
\\n\"
send_user \"Run the updater before playing the game (yes it will take alot of time. so take some coffee).\\n\"
send_user \"Without this the game has no picture, music, models, world maps, everything.\\n\"
send_user \"Special thanks to kronon for the information above and providing the inspiration for this script!\\n\"
 
exit


Special thanks go to Kronon whose previous work this script is based on, and without whom this script would not have been possible
« Last Edit: January 04, 2005, 02:16:45 am by hybrasyl »

confused

  • Hydlaa Citizen
  • *
  • Posts: 269
    • View Profile
(No subject)
« Reply #1 on: January 04, 2005, 07:38:05 am »
Yeppie!

Something for the non-programmers. Oh, what packages should be installed before running this script? I have Suse 9.1.

Thanx hybrasyl! You my hero!

:)

Nedhrys

  • Traveller
  • *
  • Posts: 13
    • View Profile
(No subject)
« Reply #2 on: January 04, 2005, 08:49:15 am »
hi there,

what does chmod a+x mean? Sorry, totally new to both Linux and Planeshift,

thanx,

Nedhrys

peeg

  • Testers
  • Hydlaa Notable
  • *
  • Posts: 560
    • View Profile
(No subject)
« Reply #3 on: January 04, 2005, 10:26:15 am »
\"chmod a+x\" means: Grant execute-privilegs to all Users(Owner/Group/Rest) for given file.
That means: Every User can execute the script.
« Last Edit: January 04, 2005, 10:30:24 am by peeg »
[ PSde ] - Join the german community!
Peeg Chaoswind - Mentor in The Rangers Of Yliakum

confused

  • Hydlaa Citizen
  • *
  • Posts: 269
    • View Profile
(No subject)
« Reply #4 on: January 04, 2005, 11:10:33 am »
Thanx, for that, I going to start now with the installation. How long did it take?

Remember I a noob to programming! :)

Here is my first error!

~/software/games/planeshift> ./ps-installer.sh
./ps-installer.sh: line 3: exec: expect: not found
« Last Edit: January 04, 2005, 11:21:35 am by confused »

RHSeeger

  • Wayfarer
  • *
  • Posts: 1
    • View Profile
(No subject)
« Reply #5 on: January 04, 2005, 04:21:18 pm »
> Here is my first error!

> ~/software/games/planeshift> ./ps-installer.sh
> ./ps-installer.sh: line 3: exec: expect: not found

That means you either don\'t have expect (its a program, and a Tcl extension) installed on your system,  or you don\'t have it in your PATH environment variable.

Marduk Kurios

  • Traveller
  • *
  • Posts: 23
    • View Profile
(No subject)
« Reply #6 on: January 04, 2005, 07:25:22 pm »
3 notes:


1-you should intall the expect program . In debian will be something like:

apt-get install expect

2-when you copy/paste appears a blanck line between the real lines, you must delete, at least, the blank lines from the beginning to the line

set setupdir \"~/planeshift\"


3-If you run this like root, you must create a planeshift folder in /root

it\'s all right now

Marduk Kurios

  • Traveller
  • *
  • Posts: 23
    • View Profile
4th note
« Reply #7 on: January 04, 2005, 07:28:05 pm »
4- you should install cvs. In debian will be something like:

apt-get install cvs

hybrasyl

  • Traveller
  • *
  • Posts: 12
    • View Profile
Supporting the script
« Reply #8 on: January 04, 2005, 07:29:38 pm »
Hey everyone, as I find workarounds for the problems in the script above I will edit the script, if you know of any fixes please post them here and I will add them to the post.  In the meantime, I have a fulltime job and a brand new baby girl to take care of, so I won\'t be able to support this script.

Please make sure at a minimum you have installed TCL/TK and LSB packages on your system, also check to make sure you have zlib and curl as well as curl-development installed.  The script should pretty much handle the rest.  But if it craps out saying something is missing, go to http://www.rpmfind.net/ and look for what packages have the missing file and or library.

To run the script you will need to have expect installed, most distros I have run, do this by default.
Expect is an extension to the TCL programming language and is installed by either LSB or TCL packages depending on your distro.

Enjoy!

raloupower

  • Wayfarer
  • *
  • Posts: 5
    • View Profile
(No subject)
« Reply #9 on: January 05, 2005, 02:37:46 am »
i\'ve this error, don\'t know why :
can\'t read \"0\": no such variable
    while executing
\"exec expect -- \"$0\" ${1+\"$@\"}\"
    (file \"./installer.sh\" line 5)
Can someone help me please? thank you.

confused

  • Hydlaa Citizen
  • *
  • Posts: 269
    • View Profile
(No subject)
« Reply #10 on: January 05, 2005, 05:51:47 am »
It says you must be ROOT. Does it only install for ROOT and can only be played while ROOT?

rapsys

  • Wayfarer
  • *
  • Posts: 2
    • View Profile
(No subject)
« Reply #11 on: January 05, 2005, 08:31:45 am »
> i\'ve this error, don\'t know why :
> can\'t read \"0\": no such variable
> while executing
> \"exec expect -- \"$0\" ${1+\"$@\"}\"
> (file \"./installer.sh\" line 5)
> Can someone help me please? thank you.

comment out the 5th line :
exec expect -- \"$0\" ${1+\"$@\"}\"
replace it by this :
#exec expect -- \"$0\" ${1+\"$@\"}\"

and run the script like this :
[root@host planeshift]$ expect -- ps-install.sh

derula

  • Hydlaa Citizen
  • *
  • Posts: 405
  • My main: Jamona Shikon
    • View Profile
    • Ugly Horst Tld.
(No subject)
« Reply #12 on: January 05, 2005, 09:09:32 am »
Quote
Originally posted by raloupower
i\'ve this error, don\'t know why :
can\'t read \"0\": no such variable
    while executing
\"exec expect -- \"$0\" ${1+\"$@\"}\"
    (file \"./installer.sh\" line 5)
Can someone help me please? thank you.


had this too, read:

Quote
Originally posted by Marduk Kurios
2-when you copy/paste appears a blanck line between the real lines, you must delete, at least, the blank lines from the beginning to the line


edit: I got an error:
Beginning Compile of Cal 3D
spawn ./autogen.sh
Running \'aclocal-1.9 \'
Running \'autoheader\'
Running \'libtoolize --force\'
Running \'automake-1.9 --add-missing --force-missing --copy\'
configure.in: installing `./install-sh\'
configure.in: installing `./missing\'
configure.in:63: required file `src/Makefile.in\' not found
configure.in:63: required file `src/cal3d/Makefile.in\' not found
Makefile.am:36: required directory ./src does not exist
spawn ./configure --prefix=/opt/cal3d
couldn\'t execute \"./configure\": no such file or directory
    while executing
\"spawn ./configure  --prefix=$installdir/cal3d\"
    (file \"install.sh\" line 209)

edit2: ran it again and got:
spawn ./make
couldn\'t execute \"./make\": no such file or directory
    while executing
\"spawn ./make\"
    (file \"install.sh\" line 213)
« Last Edit: January 05, 2005, 09:28:24 am by derula »

rapsys

  • Wayfarer
  • *
  • Posts: 2
    • View Profile
(No subject)
« Reply #13 on: January 05, 2005, 09:49:10 am »
I re-write the script in REAL bash!

dl it their : http://rapsys.free.fr/planeshift.sh

my mail if trouble rapsys_free_fr
(do not forget to put planetshift in subject)
first _ = @
second _ = .

raloupower

  • Wayfarer
  • *
  • Posts: 5
    • View Profile
(No subject)
« Reply #14 on: January 05, 2005, 09:51:53 am »
My first problem is clear, thank you, but i\'ve got now the same problem with \".make\". I\'ve got
spawn ./make
couldn\'t execute \"./make\": no such file or directory
    while executing
\"spawn ./make\"
    (file \"installer.sh\" line 228)


i edit once again, i\'m trying the new bash script.
« Last Edit: January 05, 2005, 10:02:33 am by raloupower »