Jump to content
Eternal Lands Official Forums
auror

Script to install el and desktop icon on ubuntu

Recommended Posts

This is a script for ubuntu (the desktop shortcut will only work in gnome) to install eternal lands. Perhaps someone could modify it for KDE and Xfce environments.

Instructions:

1. Download the 32 bit or 64 bit script

2. Right click your downloaded script, and press the "Properties option"

3. Click the "Permissions" tab

3. Check the "Allow executing file as a program" box.

4. Close the properties box by clicking the "Close" button.

5. Double click the script and select "Run in Terminal"

 

Downloads

32 bit Gnome (most users): http://elguidebook.atspace.com/el_install_32b

64 bit Gnome: http://elguidebook.atspace.com/el_install_64b

Right click on the respective download link, and select "Save Link As..."

 

Auror

Edited by auror

Share this post


Link to post
Share on other sites

Nice work. Just 3 quick notes:

 

#!/bin/bash

cd /usr/share/games

[1] sudo wget http://download.softpedia.ro/dl/8867f2bbf7...l_160_linux.zip

sudo unzip el_160_linux.zip

sudo chmod +x el.x86.linux.bin

cd /usr/bin

[2] sudo wget http://elguidebook.atspace.com/el

sudo chmod +x el

cd

cd Desktop/

[3] wget http://elguidebook.atspace.com/Eternal_Lands.desktop

 

[1] The download doesn't work for me. This seems to be the correct url:

http://download.softpedia.ro/dl/93535e7b548df2b6d9819ee6f3399def/48215993/600000611/linux/games/el_160_linux.zip

[2] What binary is being downloaded here and why don't you just use the shipped binary in the zip? :wub:

 

[3] This only works for the Gnome Desktop afaik.

Share this post


Link to post
Share on other sites

Very good idea :rolleyes:

 

Tried it on my Ubuntu Hardy Heron. After a few modifications I ended up with a working install but a dead desktop link /:

 

But anyway...my computer has had a bit of a problem executing bin-files lately (could only make the el.x86.linux.bin work from the menu if I removed the extension 'bin' from the filename...anyone knows why?) , so maybe this desktop-file is related.

 

As for the corrections...first was inserting Gampas download link as the first didn't work. Secondly...it seems that you forgot to change the directory before changing the permissions (:

 

#!/bin/bash
cd /usr/share/games
sudo wget [url="http://download.softpedia.ro/dl/8867f2bbf798375524f4a259470e56e5/4820d1b6/600000611/linux/games/el_160_linux.zip"]http://download.softpedia.ro/dl/8867f2bbf7...l_160_linux.zip[/url]
sudo unzip el_160_linux.zip
[b][color="#FF0000"]cd el_160_linux[/color][/b]
sudo chmod +x el.x86.linux.bin
cd /usr/bin
sudo wget [url="http://elguidebook.atspace.com/el"]http://elguidebook.atspace.com/el[/url]
sudo chmod +x el
cd
cd Desktop/
wget [url="http://elguidebook.atspace.com/Eternal_Lands.desktop"]http://elguidebook.atspace.com/Eternal_Lands.desktop[/url]

 

Aside from that...using the "Desktop" directory assumes the user has the English Ubuntu system installed. As I don't, I just had to change it to the Desktop for my system. After that it worked fine...

 

Now I'm just wondering about the dead desktop link /:

 

//Zilvador

Share this post


Link to post
Share on other sites
Please test my script to download, install, and create a desktop launcher to run Eternal Lands.

This script was specifically made for Ubuntu Hardy, but it may work on other distros.

If this turns out to work, maybe I could ask someone to put it on the download page :whistle:

Why not use the native package manager? Distros such as archlinux and gentoo already have Eternal Lands, and I think a .deb or .rpm package (if not already available) would be much more useful than a script to install it without package management, possibly causing uninstall problems, version conflicts, or shared library dependency problems down the road.

Edited by crusadingknight

Share this post


Link to post
Share on other sites
Now I'm just wondering about the dead desktop link /:

May be because this download "http://elguidebook.atspace.com/el" is pointing to a users directory rather than the install location:

#!/bin/bash
cd /usr/share/games
sudo wget [url="http://download.softpedia.ro/dl/8867f2bbf798375524f4a259470e56e5/4820d1b6/600000611/linux/games/el_160_linux.zip"]http://download.softpedia.ro/dl/8867f2bbf7...l_160_linux.zip[/url]
sudo unzip el_160_linux.zip
[b][color="#FF0000"]cd el_160_linux[/color][/b]
sudo chmod +x el.x86.linux.bin
cd /usr/bin
sudo wget [url="http://elguidebook.atspace.com/el"]http://elguidebook.atspace.com/el[/url]
sudo chmod +x el
cd
cd Desktop/
wget [url="http://elguidebook.atspace.com/Eternal_Lands.desktop"]http://elguidebook.atspace.com/Eternal_Lands.desktop[/url]

 

Aside from that...using the "Desktop" directory assumes the user has the English Ubuntu system installed. As I don't, I just had to change it to the Desktop for my system. After that it worked fine...

 

Now I'm just wondering about the dead desktop link /:

 

//Zilvador

Fixed

Edited by auror

Share this post


Link to post
Share on other sites

A launcher can run the executable properly without cd'ing if data_dir is set correctly. Thats part of the reason data_dir exists so that a cd isn't required.

Share this post


Link to post
Share on other sites
Why not use the native package manager? Distros such as archlinux and gentoo already have Eternal Lands, and I think a .deb or .rpm package (if not already available) would be much more useful than a script to install it without package management, possibly causing uninstall problems, version conflicts, or shared library dependency problems down the road.

All very good points. A proper package for each disto would be great but a lot of work. We'd probably get several different people to do the different distros I guess. I've looked before into doing a package for Debian and Ubuntu but never quite got over that initial learning curve; I really must try harder...

 

Please test my script to download, install, and create a desktop launcher to run Eternal Lands.

A couple more comments about the script. Some might prefer to install the game as a normal user into their home directory so may be the path could be user read from stdin. On a related note, do you need to write the el script to /usr/bin? Why not just put it in the install directory and change the .desktop file point there. Finally, you could save downloading the desktop and el script from your web server by creating them directly from your script. Hope you don't mind but here's some example bash script...

#! /usr/bin/env bash


definstallpath="/usr/share/games/"
read -p "Full path to install: [$definstallpath] " installpath
[ "$installpath" = "" ] && installpath=$definstallpath

# .....

cat > $installpath/el_install/el << ENDOFTEXT
#! /usr/bin/env bash
cd $installpath/el_install
./el.x86.linux.bin
ENDOFTEXT
chmod a+rx $installpath/el_install/el

cat > ~/Desktop/Eternal_Lands.desktop << ENDOFTEXT
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Eternal Lands
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=Eternal Lands
Exec=$installpath/el_install/el
Icon=$installpath/el_install/elc.ico
ENDOFTEXT

Share this post


Link to post
Share on other sites
All very good points. A proper package for each disto would be great but a lot of work. We'd probably get several different people to do the different distros I guess. I've looked before into doing a package for Debian and Ubuntu but never quite got over that initial learning curve; I really must try harder...

 

The kind people at http://www.getdeb.net/ had built a DEB package for Debian/Ubuntu that worked great, it was an older version though (1.32 I think) and they didn't update it later on. You could perhaps look at it as a starting point and/or ask them to build a new package?

 

Rehdon

Share this post


Link to post
Share on other sites
All very good points. A proper package for each disto would be great but a lot of work. We'd probably get several different people to do the different distros I guess. I've looked before into doing a package for Debian and Ubuntu but never quite got over that initial learning curve; I really must try harder...

 

The people at packman provide an Eternal Lands rpm for various opensuse-versions.

http://packman.links2linux.de/package/elc

http://packman.links2linux.de/package/elc-data

Share this post


Link to post
Share on other sites

I used a modified version of bluap's script as the main base of the new script. I changed the default directory to the home folder, because I think that it would be easier to add music, change maps (I know some people use el-cel or other maps), add music etc.

Unfortunately, I couldn't get the el script to write directly to /usr/bin so I made it write to the home directory and then cut it with sudo over to /usr/bin

 

Please test my script to download, install, and create a desktop launcher to run Eternal Lands.

A couple more comments about the script. Some might prefer to install the game as a normal user into their home directory so may be the path could be user read from stdin. On a related note, do you need to write the el script to /usr/bin? Why not just put it in the install directory and change the .desktop file point there. Finally, you could save downloading the desktop and el script from your web server by creating them directly from your script. Hope you don't mind but here's some example bash script...

The script needs to be in /usr/bin so you don't have to cd to the directory, then execute it with ./el (same problem as executing ./el.x86.linux.bin) When you put it in /usr/bin, you can execute it just by typing el in the terminal, or putting el as the command to execute in a launcher, no cd'ing required.

 

Another note: the command I posted earlier to get the link from the softpedia site (as the link always changes when you reload the page) sends many unnecessary http requests. I whittled this down to 4, and I can't get those because they are links to softpedia.com (rather then name.softpedia.com). When I attempt to add softpedia.com to the exclude domains list, It prevents the zip file from downloading.

 

New wget command:

sudo wget -rH -l1 -np -nd --accept=.zip -erobots=off --exclude-domains=download.softpedia.ro,mac.softpedia.com,linux.softpedia.com,drivers.soft
pedia.com,archive.softpedia.com,board.softpedia.com,forum.softpedia.com,games.sof
tpedia.com,handheld.softpedia.com,mac.softpedia.com,news.softpedia.com,webscripts
.softpedia.com,mobile.softpedia.com,win.softpedia.com http://linux.softpedia.com/progDownload/Eternal-Lands-Download-611.html

 

I have looked into making a .deb file, but decided a script would be easier to make. The script has several advantages over a deb file, including easier to change, you can change the installation directory, and add a desktop icon.

 

I also made the script remove the zip file after extraction.

 

Auror

Edited by auror

Share this post


Link to post
Share on other sites

For that we need an entry in /etc/apt/sources.list file.

Unfornatelly don't know download location for .deb repository.

Couldn't run el in gnome desktop shortcut too so i put .sh file in there that looks like that:

 

#!/bin/sh

cd /usr/share/games/el

./.el.x86.linux.bin

Share this post


Link to post
Share on other sites

since i can't sleep tonight , i decided to hijack this thread :pirate:

i also read Meltol's thread here and since almost every new user

steps in the same traps i decided to make another script which has

some improved features:

 

[x] installs into ~/ (no sudo needed)

[x] downloads files from different mirrors

[x] uses wget, too (incl. continuing off aborted download)

[x] checks md5 hashes of downloaded files

[x] is able to extract downlaod urls from html pages (like the softpedia one)

[x] updates #data_dir in the .elc/<servers>/el.ini

 

May 16 2008, update/added features

[x] ask user to keep damaged/incomplete files for later resuming

[x] its possible to retry after download from all mirrors failed

[x] extended setup / low graphics mode (#poor_man = 1; #video_mode= 2; #full_screen= 0; )

[x] extended setup / change web browser

[fix]no longer using placid's as first mirror

 

Jul 14 2008

dunno if someone uses this script but i add the md5sum of the 1.70 release package:

 

so here it is:

 

#! /usr/bin/perl


use strict;
use warnings;

my $dir     = $ENV{HOME}."/Eternal-Lands_1.60/";        # directory to download the el files to
my $idir    = $dir."el_install/";                       # the directory there the extracted files are
my $tmpfile = 'el_linux_170_install.zip';                       # name of the zipfile we're downloading
my $hash    = 'd3d32e1920efb172e7de58efe0db9788';       # md5 hash of the file

# history :
# 7ecce3b1523ea3993ba86918eeb0e622  v1.60
# d3d32e1920efb172e7de58efe0db9788  v1.70

chomp(my $wget   = `which wget`);
chomp(my $unzip  = `which unzip`);
chomp(my $md5sum = `which md5sum`);

my $m      = `uname -m`;
my $stat   = undef;

mkdir($dir)unless(-e $dir);

my %conflist = (

   # to enable another server profile simply add it here

   install    =>     $idir,
   test       =>     $ENV{HOME}."/.elc/test/",
   main       =>     $ENV{HOME}."/.elc/main/",
   pk         =>     $ENV{HOME}."/.elc/pk/"

);

my %mirrors = (

   # add other mirrors here, both direct links and links to html pages containing
   # direct links are supported (no javascript generated  links/pages of course)

   # softpedia link was not available yet
   #mirror_0_softpedia =>   "http://linux.softpedia.com/progDownload/Eternal-Lands-Download-611.html",

   mirror_1_placid    =>   "http://el.beplacid.net/downloads/el_linux_170_install.zip",

   mirror_2_eternallands => 'http://www.eternal-lands.com/el_linux_170_install.zip'

);

  *slurp = sub{
   local $/ = undef;
   my $file = shift;
   open(F,"<$file")or die "\n\n$! ($file)\n\n";
   my $data = <F>;
   close F;
   return $data;
  };

  *blurb = sub{
   my $file = shift;
   my $data = shift;
   open(F,">$file")or die "\n\n$! ($file)\n\n";
   print F $data;
   close F;
  };

  *mpush = sub{
   my $cnt = $_[0];
   print "\n\nFound download link in file! ($_[1])\n\n";
   $$cnt++;
   $mirrors{'generic_link_'.$$cnt} = $_[1];
   };



sub download{
   my $next = shift;
   my $tfile = $tmpfile;
   foreach(sort keys(%mirrors)){
       my $mirror = $mirrors{$_};
       next if($mirror eq '');
       $_ = "generic extracted url" if(defined($next));
       print "\nDownloading from $_, this may take some time...\n\n";

       if(-e $wget){
           if(defined($next)){
               $mirror = $next;
           }
           if($mirror =~ m/([\w\d.-]+)$/){
               $tfile = $1;
           }
           system("wget -c -P ".$dir." ".$mirror);
       }
       else{
            die "\n\nwe need wget to download the files needed :|\n";
           }

       unless(-e $md5sum){
           die "\n\nmd5sum not found, can't verify downloaded data! aborted!\n\n";;
       }

       my $tmphash = `md5sum $dir$tfile`;
       $tmphash    =~ s;^([\w\d]+).*$;$1;gis;

       unless($hash eq $tmphash){
           warn "\n\nFile dosen't look like the data we expected... looking into it...\n\n";
           my $unkowndata  = slurp($dir.$tfile);
           my $cnt         = 0;

           if($unkowndata  =~ m;(http://[\d\w/.-]+$tmpfile){
               my $url     = $1;
               $unkowndata =~ s;(http://[\d\w/.-]+$tmpfile);mpush(\$cnt,$1);gise;

               unless(defined($next)){
                   unlink($dir.$tfile);
                   download($url,1);
                   next;
               }
               else{
                   warn "\n\n...but we got this link, from a file which wasn't the file we wanted reffered by the mirroer we selected before... guess what: i'll give up following this one\n\n";
               }
           }
           else{
               print "\n\nOk, this file is pure garbage...\n\n";
           }
           warn "\n\ndownloaded file seems to be damaged, retrying another mirror...\n\n";
           print "keep the file? when it's only not complete, we can try to continue later.\nkeep file? [yes/no] :";
           chomp(my $keep = <>);
           if($keep =~ m;no;i){
               print "\nremoving $dir$tfile...\n";
               unlink($dir.$tfile);
           }
           else{
               print "\ntrying to complete file from another mirror...\n";
           }
       }
       else{
            print "\n\ndownload successful!\n\n";
            $stat = 1;
            last;
       }
       last if(defined($next));
   }
}

{
   &download;

   unless(defined($stat)){
       warn "\n\nfor some reason the download of the game files failed, installation aborted...\n";
       print "retry? [yes/no] :";
       chomp(my $retry = <>);
       redo if($retry =~ m;yes;i);
       print "\n\nOk! bye!\n";
       exit;
   }
   else{
       if(-e $unzip){
           system("unzip $dir$tmpfile -d $dir");
           print "\n\nUpdating configuration files...\n\n";
           mkdir($ENV{HOME}."/.elc") unless(-e $ENV{HOME}."/.elc");

           foreach(keys(%conflist)){
               my $value = $conflist{$_};
               print "\nUpdating $_ in $value...\n";
               mkdir($value) unless(-e $value);
               my $newconf;

               if(-e $value."el.ini"){
                   $newconf = slurp($value."el.ini");
               }
               else{
                   $newconf = slurp($idir."el.ini");
               }
               $newconf =~ s/#data_dir.*?".*?"/#data_dir = "$idir"/gis;
               blurb($value."el.ini",$newconf);
           }

           unless(-e $ENV{HOME}."/.elc/servers.lst"){
               print "\n\ncopying servers.lst to config directory...\n\n";
               blurb($ENV{HOME}."/.elc/servers.lst", slurp($idir."servers.lst"));
           }

           if(-e $ENV{HOME}."/Desktop"){
               print "\ncreating symlink on Desktop...\n";
               my $desktoplink = $ENV{HOME}."/Desktop/Eternal-Lands";

               if(-l $desktoplink){
                   unlink($desktoplink);
               }

               unless($m =~ m/64/){
                   symlink($idir."el.x86.linux.bin",$desktoplink);
               }
               else{
                   symlink($idir."el.x86-64.linux.bin",$desktoplink);
               }
               chmod(0755,$desktoplink);
           }
           print "\n\n\nBasic installation done! \n".
                 "run extended setup? [yes/no] :";
           chomp(my $exsetup = <>);

           if($exsetup =~ m;yes;i){
               print "\nset low grafic mode?[yes/no] :";
               chomp(my $gfx = <>);

               if($gfx =~ m;yes;i){
                   foreach(keys(%conflist)){
                       my $conf = $conflist{$_}."el.ini";
                       my $data = slurp($conf);
                       $data =~ s;#full_screen.*?=.*?[\d]+;#full_screen= 0;gis;
                       $data =~ s;#video_mode.*?=.*?[\d]+;#video_mode= 2;gis;
                       $data =~ s;#poor_man.*?=.*?[\d]+;#poor_man= 1;gis;
                       blurb($conf,$data);
                   }
                   print "\n...done!\n";
               }
               else{
                   print "\n...skipped\n";
               }

               print "\nwhich webbrowser you use? :";
               chomp(my $browser = <>);

               if($browser  =~ m;(\w+);i){
                   $browser = $1;
                   foreach(keys(%conflist)){
                       my $conf = $conflist{$_}."el.ini";
                       my $data = slurp($conf);
                       $data =~ s;#browser.*?=.*?".*?";#browser= "$browser";gis;
                       blurb($conf,$data);
                   }
                   print "\n...done!\n";
               }
               else{
                   print "\n...skipped\n";
               }
               print "\nOk, Setup done! \n";
           }
           else{
               print "\n...skipped\n";
           }
       }
       else{
           die "\n\nunzip not found, installation aborted...\n\n";
       }
   }
}

Edited by Marr

Share this post


Link to post
Share on other sites
since i can't sleep tonight , i decided to hijack this thread :whistle:

Apart from being written in that write-only language perl, very nice. :P. The script worked fine for me, I did a test run on a dummy account with no previous files. Now we have two install scripts:)

 

Joking aside, I can't read perl too well. What does the script do if you already have an ~/.elc/ tree with el.ini and server.lst files you want to keep? I could do an experiment but... May be it could ask to overwrite or at least check the data_dir path is correct if it doesn't overwrite.

Share this post


Link to post
Share on other sites
Joking aside, I can't read perl too well. What does the script do if you already have an ~/.elc/ tree with el.ini and server.lst files you want to keep? I could do an experiment but... May be it could ask to overwrite or at least check the data_dir path is correct if it doesn't overwrite.

 

when the servers.lst already exists the script don't change it, assuming its ok. the el.ini files in the server profiles will be created if they don't exist (the directory's, too). #data_dir is updated always either using a el.ini copy from install dir, or if it already exits the one in the server profile.

Share this post


Link to post
Share on other sites
when the servers.lst already exists the script don't change it, assuming its ok. the el.ini files in the server profiles will be created if they don't exist (the directory's, too). #data_dir is updated always either using a el.ini copy from install dir, or if it already exits the one in the server profile.

Perfect! :icon13:

Share this post


Link to post
Share on other sites

The correct way of doing Desktop shortcuts I think is:

1. check if ~/.config/user-dirs.dirs exists and parse it if so (it is a freedesktop standard or smth, shouldn't be GNOME or English specific)

2. This file should contain line like

XDG_DESKTOP_DIR="$HOME/Desktop"

parse it, and use it

3. If the above fails, you can still try looking for ~/Desktop

Share this post


Link to post
Share on other sites

These scripts to install el are great. However, as suggest many times before, using .deb package might be the way to go. I've given his a try and produced a few packages. The packages and the package creation files are available for download. Note these are unofficial packages but they are built from unchanged CVS source and the released data files so can used on the main server. This is the thread I started in an attempt to get some feedback. Please add any comments there. Thanks. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×