Jump to content


Photo

[Not a bug] - Lunch script


  • Please log in to reply
65 replies to this topic

#21 Urfoex

Urfoex

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 322 posts
  • LocationGermany

Posted 03 May 2011 - 11:11 AM

can anyone show/teach me the noob on how actually to use this launcher script? :)


It's really easy.
Create a text-file inside the OilRush folder.
Name it something like: lunch.sh (in honor to its creator :laugh:)
Copy the code from here and paste it inside that file.
Save it.
Maybe make that file executable ( right click - properties - permission - is executable (could be a little different with your desktop environment) ; or in the console: chmod +x launch.sh)
And then either click on the script to start it
or use the console with: sh lunch.sh
or: ./lunch.sh

You maybe need to adjust some lines for your pleasure
or also add that line:
http://oilrush-game....ndpost__p__1860
if that's not already in.

#22 maizuddin

maizuddin

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 282 posts
  • LocationKuala Lumpur , Malaysia

Posted 03 May 2011 - 11:28 AM

It's really easy.
Create a text-file inside the OilRush folder.
Name it something like: lunch.sh (in honor to its creator :laugh:)
Copy the code from here and paste it inside that file.
Save it.
Maybe make that file executable ( right click - properties - permission - is executable (could be a little different with your desktop environment) ; or in the console: chmod +x launch.sh)
And then either click on the script to start it
or use the console with: sh lunch.sh
or: ./lunch.sh

You maybe need to adjust some lines for your pleasure
or also add that line:
http://oilrush-game....ndpost__p__1860
if that's not already in.


Thanks for the reply :)
I get messed up a little when I don't actually run the script properly maybe?
I execute and run it, but then , there is no window appear?
hmm,where should I look at actually?
by the way , im using ubuntu 11.04

I'm soo afraid of asking due to my lack or no knowledge at all :), still i want to learn the script also :) I mean,.. making the script. :)

#23 maizuddin

maizuddin

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 282 posts
  • LocationKuala Lumpur , Malaysia

Posted 03 May 2011 - 11:31 AM

Thanks for the reply :)
I get messed up a little when I don't actually run the script properly maybe?
I execute and run it, but then , there is no window appear?
hmm,where should I look at actually?
by the way , im using ubuntu 11.04

I'm soo afraid of asking due to my lack or no knowledge at all :), still i want to learn the script also, what i mean is, learn on how to do it.:)



#24 Urfoex

Urfoex

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 322 posts
  • LocationGermany

Posted 03 May 2011 - 11:43 AM

Thanks for the reply :)
I get messed up a little when I don't actually run the script properly maybe?
I execute and run it, but then , there is no window appear?
hmm,where should I look at actually?
by the way , im using ubuntu 11.04

I'm soo afraid of asking due to my lack or no knowledge at all :), still i want to learn the script also :) I mean,.. making a script. :)


You don't need to be afraid. Everyone has started someone :thumbsup:

Try starting the script from the console or terminal. That should nearly always tell you something about what could went wrong.
$cd /path/to/my/OilRush/folder
# maybe is something like: ~/OilRush0.62
# ~ stands for your user-home-directory ( so maybe: /home/mai )
# what would lead to /home/mai/OilRush0.62
$sh lunch.sh

Then there should appear some lines of text-messages and hopefully the game should start-up.
If not try to put the messages here.

#25 maizuddin

maizuddin

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 282 posts
  • LocationKuala Lumpur , Malaysia

Posted 03 May 2011 - 05:30 PM

You don't need to be afraid. Everyone has started someone :thumbsup:

Try starting the script from the console or terminal. That should nearly always tell you something about what could went wrong.

$cd /path/to/my/OilRush/folder
# maybe is something like: ~/OilRush0.62
# ~ stands for your user-home-directory ( so maybe: /home/mai )
# what would lead to /home/mai/OilRush0.62
$sh lunch.sh

Then there should appear some lines of text-messages and hopefully the game should start-up.
If not try to put the messages here.


Now I just realize why the script did not start...I need to go to the terminal and run it with sudo. do I need to do this always?

#26 Urfoex

Urfoex

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 322 posts
  • LocationGermany

Posted 03 May 2011 - 10:15 PM

Now I just realize why the script did not start...I need to go to the terminal and run it with sudo. do I need to do this always?


No!

Don't try it with sudo.
You don't need the rights of the administrator to run the script or the game.
On a normal day live you nearly never need sudo.

Just try it with a normal terminal and as normal user.
Please try to tell us a little bit more (maybe step by step) about what you are doing so we can tell you what you are doing wrong.

#27 maizuddin

maizuddin

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 282 posts
  • LocationKuala Lumpur , Malaysia

Posted 04 May 2011 - 01:52 AM

No!

Don't try it with sudo.
You don't need the rights of the administrator to run the script or the game.
On a normal day live you nearly never need sudo.

Just try it with a normal terminal and as normal user.
Please try to tell us a little bit more (maybe step by step) about what you are doing so we can tell you what you are doing wrong.


ok, thanks for the reply guys :)

here is the output when I don't use sudo(this one when I put the game inside usr/local/share/games):
adib@pc35:~$ sh launch.sh 
Game version is: 0.62
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
start the game with gdb
32 bit system detected: use 32 bit version
tee: /oilrush-debug.2011-05-04 09:49:23+08:00.log: Permission denied
rm: cannot remove `/cmd.txt': No such file or directory

and this one when i put the game at @HOME :
adib@pc35:~$ sh launch.sh 
Game version is: 0.62
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
start the game with gdb
32 bit system detected: use 32 bit version
tee: /oilrush-debug.2011-05-04 09:51:37+08:00.log: Permission denied
rm: cannot remove `/cmd.txt': No such file or directory

it almost the same output, but when I sudo sh launch.sh it launch nicely
:)

#28 Urfoex

Urfoex

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 322 posts
  • LocationGermany

Posted 04 May 2011 - 07:24 AM

ok, thanks for the reply guys :)

here is the output when I don't use sudo(this one when I put the game inside usr/local/share/games):

adib@pc35:~$ sh launch.sh 
Game version is: 0.62
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
start the game with gdb
32 bit system detected: use 32 bit version
tee: /oilrush-debug.2011-05-04 09:49:23+08:00.log: Permission denied
rm: cannot remove `/cmd.txt': No such file or directory

and this one when i put the game at @HOME :
adib@pc35:~$ sh launch.sh 
Game version is: 0.62
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
launch.sh: 72: cannot create /cmd.txt: Permission denied
start the game with gdb
32 bit system detected: use 32 bit version
tee: /oilrush-debug.2011-05-04 09:51:37+08:00.log: Permission denied
rm: cannot remove `/cmd.txt': No such file or directory

it almost the same output, but when I sudo sh launch.sh it launch nicely
:)


How did you install or put the game into /usr/local/share/games and your /home/adib folders?

I made my OilRush-0.62.run executable and did a ./OilRush-0.62.run from a terminal inside the folder I had downloaded it in.
Something like that:
~$ cd ~/Downloads/games/unigine
~/Downloads/games/unigine$ chmod +x OilRush-0.62.run
~/Downloads/games/unigine$ ./OilRush-0.62.run

That would simply extract the game inside that folder.
I would get
~/Downloads/games/unigine/OilRush-0.62$
and would put the lunch.sh script file inside that folder. And then I would simply start the lunch script.
(! Everything without sudo.)

If I made it like this:
  • right click on OilRush-0.62.run for properties
  • change properties to let it be a executable
  • left click on OilRush-0.62.run to run it
It would extract itself inside my $HOME folder.
I would get a
~/OilRush-0.62$
and would put the lunch.sh again in that folder.
(! Again all without sudo.)


That line
launch.sh: 72: cannot create /cmd.txt: Permission denied
indicates that you as a normal user don't have the permission to create a file on / (the root directory). That is normal. But the script does not try to create the file on / . It tries to write the file to $debugdir/cmd.txt as could be seen in
echo "run" > $debugdir/cmd.txt
and its following lines.
With $debugdir being set to
debugdir="$HOME/.OilRush"
in your case it should be
/home/adib/.OilRush/cmd.txt
unless you changed the $debugdir variable.
Did you?

#29 luziferius

luziferius

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 269 posts
  • LocationGermany

Posted 05 May 2011 - 09:47 PM

ok i was a way too long time offline... (the Abitur is near :wink: )
thank you Defense for updating the script!!
as I saw, you only added the 0.62 preselection for simple version selection and changed the cmd argument to waterwar/menu for the game to start, right?(i just quickly looked over it)
then, everything should be perfectly fine.
i think the screenshot format can only be changed in the config file... to do this one-time thing i have to implement file parsing.
I don't think its worth the hassle, so (from my side) it won't happen (i think POSIX and don't blow the script up :whistling:)
===========
@ Urfoex:
the script uses bash syntax, so starting it with sh is not the best thing to do (but the shebang than should instruct sh to start bash for the script(does that work that way or is sh forced here?))
there is another possibility, rather than a changed debugdir (and that's a REALLY bad thing i never thought it does exist somewhere):
there is no $HOME or $HOME is set to ""! then $debugdir is actually /
@ maizuddin:
which linux distribution do you use?
please enter some simple commands in the console to check the thing with $HOME(only if you didn't change the debugdir):
  • echo $HOME
  • sh
  • echo $HOME
  • bash
  • echo $HOME
echo $HOME prints the value of your $HOME variable
you should get your home folder /home/your_username 3 times
if you get no output at all, then $HOME is not set (it's bad)
if you get 2 or 1 outputs, then the variable is lost when you start a new shell(that's even worse)

#30 maizuddin

maizuddin

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 282 posts
  • LocationKuala Lumpur , Malaysia

Posted 05 May 2011 - 11:34 PM

How did you install or put the game into /usr/local/share/games and your /home/adib folders?

I made my OilRush-0.62.run executable and did a ./OilRush-0.62.run from a terminal inside the folder I had downloaded it in.
Something like that:

~$ cd ~/Downloads/games/unigine
~/Downloads/games/unigine$ chmod +x OilRush-0.62.run
~/Downloads/games/unigine$ ./OilRush-0.62.run

That would simply extract the game inside that folder.
I would get
~/Downloads/games/unigine/OilRush-0.62$
and would put the lunch.sh script file inside that folder. And then I would simply start the lunch script.
(! Everything without sudo.)

If I made it like this:
  • right click on OilRush-0.62.run for properties
  • change properties to let it be a executable
  • left click on OilRush-0.62.run to run it
It would extract itself inside my $HOME folder.
I would get a
~/OilRush-0.62$
and would put the lunch.sh again in that folder.
(! Again all without sudo.)


That line
launch.sh: 72: cannot create /cmd.txt: Permission denied
indicates that you as a normal user don't have the permission to create a file on / (the root directory). That is normal. But the script does not try to create the file on / . It tries to write the file to $debugdir/cmd.txt as could be seen in
echo "run" > $debugdir/cmd.txt
and its following lines.
With $debugdir being set to
debugdir="$HOME/.OilRush"
in your case it should be
/home/adib/.OilRush/cmd.txt
unless you changed the $debugdir variable.
Did you?


hooo, now I understand, thank you for letting me know about this.

#31 Defense

Defense

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 191 posts

Posted 07 May 2011 - 09:45 AM

i think the screenshot format can only be changed in the config file... to do this one-time thing i have to implement file parsing.
I don't think its worth the hassle, so (from my side) it won't happen (i think POSIX and don't blow the script up :whistling:)


yes with the screenshot format we should wait until it works with the console parameter. :)

#32 luziferius

luziferius

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 269 posts
  • LocationGermany

Posted 29 May 2011 - 03:11 PM

*UPDATE*
As you all know, most things improve over time. The well known lunch script just got hotter; so here is the new version!
Changes:
  • NEW: some sort of file header with short description
  • IMPROVED: completely redone game folder detection (the old way to force it is still possible)
just put the script into the game folder( and make it executable); then you can: click it and play!
the new detection code can handle almost every possible way it can be called:(assumed the script is named lunch.sh)
  • "./lunch.sh"
  • "/full/path/to/lunch.sh"
  • "/some/path/../../another/path/lunch.sh"
  • "./some/folder/lunch.sh"
  • even when called via multiple depth softlink /symlink
so you can symlink the lunch.sh into eg. /usr/local/bin and start the game by typing "lunch.sh" into your console!
Always look out for newer versions before downloading
Newest version will be always here
Spoiler


#33 binstream

binstream

    Producer

  • Pre-Order
  • PipPipPip
  • 668 posts
  • LocationTomsk, Russia

Posted 30 May 2011 - 06:26 AM

Great work, guys!

Topic is pinned.

#34 Ypnose

Ypnose

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 202 posts
  • LocationFrance, At the top of the Eiffel tower

Posted 30 May 2011 - 09:38 AM

Hum, it seems you did an amazing and tricky work luziferius.
I will check it out because I like use some scripts on my system.

EDIT: REALLY IMPRESSIVE!

#35 Ypnose

Ypnose

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 202 posts
  • LocationFrance, At the top of the Eiffel tower

Posted 30 May 2011 - 10:14 AM

Anyway, I think that "gameversion=xx" is not "Almost obsolete".
All options was commented, and an oilrush-.cfg has been generated with strange parameters. Oilrush-0.631.cfg was created before. I uncommented the right line, and now it's perfect.

#36 luziferius

luziferius

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 269 posts
  • LocationGermany

Posted 30 May 2011 - 10:20 AM

hmmm.... that means that $gameversion is not detected properly...
i did it by cutting out the number out of the only cfg file in the oilrush root dir...
for that, i used ls to find the file... it seams that the
ls oilrush-*.cfg
does not work on every system....
so the output of
echo "Game version is: $gameversion"
should then be empty for you, which is bad...
as i said, it IS "Almost obsolete", as the script should find the proper version for you
would you please do a little debugging? cd into the game root dir and do
ls oilrush-*.cfg
and tell me what the output of it is.

for me, it is
~/OilRush-0.631$ ls oilrush-*.cfg
oilrush-0.631.cfg
~/OilRush-0.631$

Edited by luziferius, 30 May 2011 - 10:25 AM.


#37 Ypnose

Ypnose

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 202 posts
  • LocationFrance, At the top of the Eiffel tower

Posted 30 May 2011 - 10:35 AM

Ok, I wrote the command:
~/Documents/OilRush-0.631$ ls oilrush-*.cfg
oilrush-0.631.cfg

I don't what's wrong. The output is same as you. I will try to start it again with gameversion=xxx commented.

#38 Ypnose

Ypnose

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 202 posts
  • LocationFrance, At the top of the Eiffel tower

Posted 30 May 2011 - 10:40 AM

Yes. I got same behavior again. I give the output under preferences folder under the $HOME.
~/.OilRush$ ls oilrush-*.cfg
oilrush-0.631.cfg oilrush-.cfg

As you can see, a file has been generated. Hope it helps.

#39 luziferius

luziferius

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 269 posts
  • LocationGermany

Posted 30 May 2011 - 10:43 AM

i'll go through the script here:

<snip the gamefolder was obtained here>
# goto game folder
cd $gamefolder
now we are in the game root folder.(you could add a simple ls here to see, if it is the right dir)
next thing to do is getting the version, as it is not set, the statement in the if is true, the inner part is executed:
#get the game version; if not set, get it from the cfg filename
if  [ -z $gameversion ]; then
        gameversion=$(ls oilrush-*.cfg) #$gameversion here is oilrush-0.631.cfg 
        gameversion=${gameversion%.*}  #$gameversion here is oilrush-0.631
       gameversion=${gameversion##*-}  #$gameversion here is 0.631
fi
echo "Game version is: $gameversion" #Game version is: 0.631
i don't know why it sometimes fails.

#40 luziferius

luziferius

    Advanced Member

  • Pre-Order
  • PipPipPip
  • 269 posts
  • LocationGermany

Posted 30 May 2011 - 10:48 AM

i have 4(!) cfg files in my home folder. they are NOT used by the script (it does the ls in the game root dir)
EDIT: the only possibility is that $gameversion is already set to something in the shell that starts the script.

Edited by luziferius, 30 May 2011 - 10:53 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users