bardsoftware / ganttproject

Official GanttProject repository.
http://ganttproject.biz
GNU General Public License v3.0
886 stars 310 forks source link

Improved startup script for linux #221

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have improved the linux bash script starting the gantt chart program (find 
attached batch and full version). It now uses readlink with option -e to 
resovle the canonical absolute path of itself to determine the directory where 
it was installed. This fix allows to point a symbolic link from for example 
/usr/local/bin/ganttproject to 
<ganttprojectinstallationpath>/ganttproject.command 

using 
ln -s <ganttprojectinstallationpath>/ganttproject.command \ 
/usr/local/bin/ganttproject

It further introduces a .GanttProject directory where the logfiles are written 
to and creates logfile names which encode the date and time of when the 
ganttproject program was started.

The only thing i could not remove is the
cd $COMMAND_PATH

as this is required by the path resolver embedded within the ganttproject 
program library. Thus I request to enable the  internal path resolver use the  
content of the $PROGRAM_PATH variable as absolute BASE_PATH for resolving and 
searching all other library and configuration file pathes. This would render 
the 
cd $COMMAND_PATH obsolete. As a consequence the user would be able to directly 
browse his/her home directory or the current directory ganttproject was started 
within, instead of the PROGRAM_PATH directory, when selecting the file open or 
save as dialog.

I just saw that there is a version of the bash script which uses readlink 
repeatedly to resolve all symbolic links, but why when readlink -e option can 
do it for you in one call? 

Further the new script checks whether ganttproject is called in batch or 
interactive mode. At least it tries to estimated it. If called in interactive 
mode it will execute ganttproject in the background. In case it is called in 
batch mode (any of the commandline arguments starts with '-') than the program 
is executed in the foreground, blocking the console until the processing has 
finished.

Greetings
Christoph

Original issue reported on code.google.com by xhnother...@gmail.com on 16 Apr 2011 at 3:10

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your patch!
I will take a look at this today and determine whether your changes are 
suitable for inclusion.

Original comment by maarten....@gmail.com on 17 Apr 2011 at 7:59

GoogleCodeExporter commented 9 years ago
I am taking a look at it and are currently stuck when project file names 
contain spaces.
Your argument checking code (especially the line containing the readlink 
command) is not able to handle spaces properly.
I will continue investigating later on.

The attachment contains my current version (full of debug warnings), so if you 
like feel free to have a look as well!

PS the ganttproject and ganttproject.command scripts served the same goal (I 
believe), so I am planning to remove the ganttproject.command script and update 
the ganttproject script

Original comment by maarten....@gmail.com on 17 Apr 2011 at 10:20

Attachments:

GoogleCodeExporter commented 9 years ago
Hi I'm currently
in a Meeting. I will have a look at it the Next days. As soon as I'm back.

Xris

-- 
g.tec Guger Technologies OG
Sierningerstrasse 14
4521 Schiedlberg
AUSTRIA, EUROPE
phone: ++43 7251 22240 17
fax: ++43 7251 22240 39
e-mail:  hintermueller@gtec.at
web:  http://www.gtec.at/

___________________________________________________________

PS: Just to let you know about our upcoming events:
 <http://www.cebit.de> Cebit 2011 (hall 9, booth D01/2) from March 1 - 5,
2011 in Hannover, Germany
 <http://www.cnsmeeting.org/> 18th Annual Cognitive Neuroscience Meeting
from April 2 - 5, 2011 in San Francisco, USA
 <http://www.ieee-ssci.org/node/1> IEEE Symposium Series on Computational
Intelligence - SSCI 2011 from April 11 - 15, 2011 in Paris, France

<http://www.gtec.at/News-Events/Workshops/g.tec-s-BCI-WORKSHOP-at-Tel-Aviv-U
niversity> g.tec's Brain-Computer Interface Workshop April 17, 2011, Tel
Aviv, Israel
 <http://www.fet11.eu/> European Future Technologies (FET) Conference from
May 4 - 6, 2011 in Budapest, Hungary
 <http://bci2011.eu/> BCI2000 Workshop from May 18 - 19, 2011 in Utrecht,
the Netherlands
 <http://bci2011.eu/> Brain-Computer Interfacing in 2011 from May 20 - 21,
2011 in Utrecht, the Netherlands
 <http://www.iwann-conference.es/> International Work Conference on
Artificial Neural Networks (IWANN 2011) from June 08 - 10, 2011 in Malaga,
Spain
 <http://www.graphonomics.org/> 15th International Graphonomics Society (IGS
2011) from June 12 - 15, 2011 in Cancun, Mexico
 <http://www.interactivemediainstitute.com/CT16/> 16th Annual
CyberPsychology and CyberTherapy Conference (Cybertherapy 2011) from June 19
- 22, 2011 in Gatineau, Canada
 <http://www.humanbrainmapping.org/i4a/pages/index.cfm?pageid=1> Human Brain
Mapping�s 17th Annual Meeting (HBM 2011) from June 26-30, 2011 in Quebec,
Canada
 <http://www.icorr2011.org/> International Conference on Rehabilitation
Robotics (ICORR 2011) from June 29 - July 1, 2011 in Zuerich, Switzerland
 <http://www.hcii2011.org/> 14th International Conference on Human-Computer
Interaction (HCI) from July 9 - 14, 2011 in Orlando, Florida, USA
Would be nice to meet you there!
 http://www.gtec.at/images/gtec.gif
___________________________________________________________

 <http://www.twitter.com/gtec_BCI> Follow us on Twitter

This message and any attached files are confidential and intended solely for
the addressee(s). Any publication, transmission or other use of the
information by a person or entity other than the intended addressee is
prohibited. If you receive this in error please contact the sender and
delete the material. The sender does not accept liability for any errors or
omissions as a result of the transmission.

Original comment by xhnother...@gmail.com on 18 Apr 2011 at 9:58

GoogleCodeExporter commented 9 years ago
After ones night of rest and a fresh cup of coffee, it seems that I used to 
wrong test to see whether spaces were working... As far as I can see the script 
works!

Revision 978ae264026a contains the updated script.
I took the liberty to modify your script to make it more robust (in my 
opinion), if you disagree please tell me!

Original comment by maarten....@gmail.com on 18 Apr 2011 at 8:49

GoogleCodeExporter commented 9 years ago
I have check it my self. Your version technically is identical to mine, see 
attached files, except that i added a warning when somebody forgot to quote or 
escape the spaces or other special characters on commandline or wants to load a 
non existing file. In this case the argument or at least the useless part 
thereof will be ignored instead replaced by empty quotes. Further in case after 
removing all useless arguments the argument string is empty it will not call 
set to change the arguments. This ensures that even in this case ganttproject 
starts in interactive mode. The patch just adds the fix for the spaces problem, 
the warnings and handling of non existent files to my previous patch.

Original comment by xhnother...@gmail.com on 20 Apr 2011 at 8:00

Attachments:

GoogleCodeExporter commented 9 years ago
Your changes to make the script more robust for spaces looked good, so I merged 
it (see revision 1a31e4772461)

Thanks for your patch.
If you have more improvements, please let us know. Otherwise, I will close the 
issue (after a week or so)

Original comment by maarten....@gmail.com on 29 Apr 2011 at 10:04

GoogleCodeExporter commented 9 years ago
Hi

Except, that it would be a good idea, to pass the PROGAM_PATH via a
commandline switch directly to the integrated path and resource browser
and make it search all jar's, modules, images, etc starting from this path
instead of the current directory. Sadly i do know too less java to be able
to create an apropriate portable batch.

Greetings

Christoph

-- 
g.tec Guger Technologies OG
Sierningerstrasse 14
4521 Schiedlberg
AUSTRIA, EUROPE
phone: ++43 7251 22240 17
fax: ++43 7251 22240 39
e-mail:  hintermueller@gtec.at
web:  http://www.gtec.at/

___________________________________________________________

PS: Just to let you know about our upcoming events:
 <http://www.cebit.de> Cebit 2011 (hall 9, booth D01/2) from March 1 - 5,
2011 in Hannover, Germany
 <http://www.cnsmeeting.org/> 18th Annual Cognitive Neuroscience Meeting
from April 2 - 5, 2011 in San Francisco, USA
 <http://www.ieee-ssci.org/node/1> IEEE Symposium Series on Computational
Intelligence - SSCI 2011 from April 11 - 15, 2011 in Paris, France

<http://www.gtec.at/News-Events/Workshops/g.tec-s-BCI-WORKSHOP-at-Tel-Aviv-U
niversity> g.tec's Brain-Computer Interface Workshop April 17, 2011, Tel
Aviv, Israel
 <http://www.fet11.eu/> European Future Technologies (FET) Conference from
May 4 - 6, 2011 in Budapest, Hungary
 <http://bci2011.eu/> BCI2000 Workshop from May 18 - 19, 2011 in Utrecht,
the Netherlands
 <http://bci2011.eu/> Brain-Computer Interfacing in 2011 from May 20 - 21,
2011 in Utrecht, the Netherlands
 <http://www.iwann-conference.es/> International Work Conference on
Artificial Neural Networks (IWANN 2011) from June 08 - 10, 2011 in Malaga,
Spain
 <http://www.graphonomics.org/> 15th International Graphonomics Society (IGS
2011) from June 12 - 15, 2011 in Cancun, Mexico
 <http://www.interactivemediainstitute.com/CT16/> 16th Annual
CyberPsychology and CyberTherapy Conference (Cybertherapy 2011) from June 19
- 22, 2011 in Gatineau, Canada
 <http://www.humanbrainmapping.org/i4a/pages/index.cfm?pageid=1> Human Brain
Mapping�s 17th Annual Meeting (HBM 2011) from June 26-30, 2011 in Quebec,
Canada
 <http://www.icorr2011.org/> International Conference on Rehabilitation
Robotics (ICORR 2011) from June 29 - July 1, 2011 in Zuerich, Switzerland
 <http://www.hcii2011.org/> 14th International Conference on Human-Computer
Interaction (HCI) from July 9 - 14, 2011 in Orlando, Florida, USA
Would be nice to meet you there!
 http://www.gtec.at/images/gtec.gif
___________________________________________________________

 <http://www.twitter.com/gtec_BCI> Follow us on Twitter

This message and any attached files are confidential and intended solely for
the addressee(s). Any publication, transmission or other use of the
information by a person or entity other than the intended addressee is
prohibited. If you receive this in error please contact the sender and
delete the material. The sender does not accept liability for any errors or
omissions as a result of the transmission.

Original comment by xhnother...@gmail.com on 29 Apr 2011 at 11:33

GoogleCodeExporter commented 9 years ago
FWIW, it doesn't work on Mac OSX anymore. readlink on Mac OSX is something 
completely different from what it is on Linux

Original comment by dbarashev on 2 May 2011 at 10:56

GoogleCodeExporter commented 9 years ago
Hi

BSD has no canonical expansion feature on readlink. A simple while [ -L $f
]  loop is not enough as along a path as symbolic links can be intermixed
with existing path parts. I'll habe a look at it and send an update latest
forthcomming weekend.

greetings
Christoph

-- 
g.tec Guger Technologies OG
Sierningerstrasse 14
4521 Schiedlberg
AUSTRIA, EUROPE
phone: ++43 7251 22240 17
fax: ++43 7251 22240 39
e-mail:  hintermueller@gtec.at
web:  http://www.gtec.at/

___________________________________________________________

PS: Just to let you know about our upcoming events:
 <http://www.cebit.de> Cebit 2011 (hall 9, booth D01/2) from March 1 - 5,
2011 in Hannover, Germany
 <http://www.cnsmeeting.org/> 18th Annual Cognitive Neuroscience Meeting
from April 2 - 5, 2011 in San Francisco, USA
 <http://www.ieee-ssci.org/node/1> IEEE Symposium Series on Computational
Intelligence - SSCI 2011 from April 11 - 15, 2011 in Paris, France

<http://www.gtec.at/News-Events/Workshops/g.tec-s-BCI-WORKSHOP-at-Tel-Aviv-U
niversity> g.tec's Brain-Computer Interface Workshop April 17, 2011, Tel
Aviv, Israel
 <http://www.fet11.eu/> European Future Technologies (FET) Conference from
May 4 - 6, 2011 in Budapest, Hungary
 <http://bci2011.eu/> BCI2000 Workshop from May 18 - 19, 2011 in Utrecht,
the Netherlands
 <http://bci2011.eu/> Brain-Computer Interfacing in 2011 from May 20 - 21,
2011 in Utrecht, the Netherlands
 <http://www.iwann-conference.es/> International Work Conference on
Artificial Neural Networks (IWANN 2011) from June 08 - 10, 2011 in Malaga,
Spain
 <http://www.graphonomics.org/> 15th International Graphonomics Society (IGS
2011) from June 12 - 15, 2011 in Cancun, Mexico
 <http://www.interactivemediainstitute.com/CT16/> 16th Annual
CyberPsychology and CyberTherapy Conference (Cybertherapy 2011) from June 19
- 22, 2011 in Gatineau, Canada
 <http://www.humanbrainmapping.org/i4a/pages/index.cfm?pageid=1> Human Brain
Mapping�s 17th Annual Meeting (HBM 2011) from June 26-30, 2011 in Quebec,
Canada
 <http://www.icorr2011.org/> International Conference on Rehabilitation
Robotics (ICORR 2011) from June 29 - July 1, 2011 in Zuerich, Switzerland
 <http://www.hcii2011.org/> 14th International Conference on Human-Computer
Interaction (HCI) from July 9 - 14, 2011 in Orlando, Florida, USA
Would be nice to meet you there!
 http://www.gtec.at/images/gtec.gif
___________________________________________________________

 <http://www.twitter.com/gtec_BCI> Follow us on Twitter

This message and any attached files are confidential and intended solely for
the addressee(s). Any publication, transmission or other use of the
information by a person or entity other than the intended addressee is
prohibited. If you receive this in error please contact the sender and
delete the material. The sender does not accept liability for any errors or
omissions as a result of the transmission.

Original comment by xhnother...@gmail.com on 3 May 2011 at 7:16

GoogleCodeExporter commented 9 years ago
Do we need to resolve each symlink on the path, by the way? Maybe the last one 
is enough? We just need a full name of a directory with eclipsito.jar file, no 
matter if it includes symlinks or not.

By the way, Christoph, sorry for such sort of nitpicking, but could you make 
your signature a little bit smaller :) ? It occupies a few times more space 
than your replies and makes the discussion somewhat hard to read,

Original comment by dbarashev on 3 May 2011 at 9:59

GoogleCodeExporter commented 9 years ago
What do you guys think of this script? I tried it on both Mac OSX and Ubuntu 
and it worked fine, being launched both directly and using a symlink.

I simplified the resolving scheme, now it resolves only $0 and takes a dirname 
of the result. Then cd to that dirname and use eclipsito.jar as classpath. 

I didn't change the way of processing the command line arguments, but if we 
manage to get rid of cd (it is necessary now but relatively easy to remove) 
then maybe they don't need any resolving at all?

Original comment by dbarashev on 6 May 2011 at 11:46

Attachments:

GoogleCodeExporter commented 9 years ago
Hi

The resolving is still needed as the archive is normally, when globally
installed by root, extracted to

/usr/local/bin/ganttproject-<version>/

and than typically admins tend to point the symlink

/usr/local/bin/ganttproject

to

/usr/local/bin/ganttproject-<version>/ganttproject

using the command

ln -s /usr/local/bin/ganttproject-<version>/ganttproject \
/usr/local/bin/ganttproject

The convenient thing about this approach is that there is no need to
fiddle with the

/etc/profile
/etc/skel/profile
/etc/skel/bashrc
$HOME/.profile
$HOME/.bashrc

files as /usr/local/bin is allready in the system PATH of the shell.
Further chaning versions is quite simple as this can be done by changing
the symlink only. And with the symlink it is mandatory to know the proper
program directory to load the proper files and to notify the integrated
path resolver where the ganttproject base directory is located. Etc.

Greetings
Christoph

Original comment by xhnother...@gmail.com on 9 May 2011 at 6:46

GoogleCodeExporter commented 9 years ago
I just noticed that line 15 will also not work on OSX and BSD as it also relies 
on readlink -f is it really necessary to resolve symlinks for files which 
ganttproject shall process or generate in batch mode ? Wouldn't it be 
sufficient to check if the file or at least the path to it exists. Rethinking 
my original suggestion the following would be sufficient and should work on any 
system which uses bash

15      argd = `sed "$arg" | sed 's#/*[^/]\+$//'` # remove terminal name
16      if [ -d "$arg" -o -e "$arg" -o -d "$argd" ] ; then 
17        argstring="$argstring '$fullargpath'"
18      else
19        echo "Warning file: '$1' not found; Forgot to escape or quote spaces?"
20      fi

Greetings Xris

Original comment by xhnother...@gmail.com on 9 May 2011 at 8:41

GoogleCodeExporter commented 9 years ago
Okay, I got the point about a symlink to symlink. So we need to resolve the 
basename until it becomes a hard link. 

I removed resolving args  completely. I don't think that it makes sense to 
check for file existence in the launch script. It is possible that it is an 
output parameter (and it is e.g. for PDF export) and it doesn't have to exist. 

Original comment by dbarashev on 9 May 2011 at 9:33

GoogleCodeExporter commented 9 years ago
The latest version of ganttproject script in the repository works on Mac OSX 
and resolves symlinks to symlinks. It also requires the latest eclipsito.jar. 
Comments welcome!

Original comment by dbarashev on 10 May 2011 at 12:03

GoogleCodeExporter commented 9 years ago
It (version Praha beta 1 (build 521)) still works on Linux (Kubuntu 11.04) when 
installed using the Debian package (build using build-deb.xml)!

Original comment by maarten....@gmail.com on 6 Jul 2011 at 11:51

GoogleCodeExporter commented 9 years ago
Cool, let's keep it then :)

Original comment by dbarashev on 6 Jul 2011 at 8:48

GoogleCodeExporter commented 9 years ago
startup script works for me in beta 2 flawlessly. If there aren't any other 
issues about i'd sugest to close.

Original comment by xhnother...@gmail.com on 24 Oct 2011 at 3:26

GoogleCodeExporter commented 9 years ago
Thanks for reminding. Changed status to "feel free to test"

Original comment by dbarashev on 24 Oct 2011 at 9:56

GoogleCodeExporter commented 9 years ago

Original comment by dbarashev on 22 Sep 2014 at 12:19