#75 modified ganttproject.sh

open
nobody
None
5
2012-07-18
2009-12-11
Giovanni Bacci
No

With the provided ganttproject.sh seems that's not possible to launch GanttProject but from the same directory (i.e. ln -s /some/dir/ganttproject.sh /usr/local/bin and then launching ganttproject.sh fails)
Attached a modified script that should work.

Discussion

  • Martin Weis
    Martin Weis
    2010-09-03

    Hi, I just had the same idea, and did the search recursively, until original is found. With a little debugging stuff the patch for version 2.0.10 is, i will attach the file if possible, too.
    3,5c3
    < GP_HOME=.
    < COMMAND_PATH=echo ${0} | sed -e "s/\(.*\)\/.*$/\1/g"
    < cd ${COMMAND_PATH}


    DEBUG="true"

    7c5,20
    < LOCAL_CLASSPATH=$GP_HOME/eclipsito.jar


    STARTSCRIPT="$0"

    check if this is a link to startscript, in case use target

    do this recursively until original file location is found...

    while [ -h "$STARTSCRIPT" ]
    do
    STARTSCRIPT=readlink "$STARTSCRIPT"
    if [ "$DEBUG" == "true" ]
    then
    echo checking for ganttproject install location: $STARTSCRIPT
    fi
    done
    GP_HOME=dirname "$STARTSCRIPT"

    COMMAND_PATH=echo ${0} | sed -e "s/\(.*\)\/.*$/\1/g"

    cd ${COMMAND_PATH}

    cd to directory, otherwise ganttproject-eclipsito-config.xml will not be found

    cd "$GP_HOME"
    9c22,24
    < CONFIGURATION_FILE=ganttproject-eclipsito-config.xml


    LOCAL_CLASSPATH="./eclipsito.jar"

    CONFIGURATION_FILE="ganttproject-eclipsito-config.xml"
    32c47,52
    < $JAVA_COMMAND -Xmx256m -classpath $CLASSPATH:$LOCAL_CLASSPATH $BOOT_CLASS $CONFIGURATION_FILE -log $LOG_FILE "$@"


    if [ "$DEBUG" == "true" ]
    then
    echo $JAVA_COMMAND -Xmx256m -classpath $CLASSPATH:$LOCAL_CLASSPATH $BOOT_CLASS $CONFIGURATION_FILE -log $LOG_FILE "$@"
    fi

    $JAVA_COMMAND -Xmx256m -classpath $CLASSPATH:$LOCAL_CLASSPATH $BOOT_CLASS $CONFIGURATION_FILE -log $LOG_FILE "$@"

     
  • Martin Weis
    Martin Weis
    2010-09-03

    Did not find a possiblility to uplad file here, so here it is:
    ::::::::::::::
    ganttproject.sh
    ::::::::::::::

    !/bin/bash

    DEBUG="true"

    STARTSCRIPT="$0"

    check if this is a link to startscript, in case use target

    do this recursively until original file location is found...

    while [ -h "$STARTSCRIPT" ]
    do
    STARTSCRIPT=readlink "$STARTSCRIPT"
    if [ "$DEBUG" == "true" ]
    then
    echo checking for ganttproject install location: $STARTSCRIPT
    fi
    done
    GP_HOME=dirname "$STARTSCRIPT"

    COMMAND_PATH=echo ${0} | sed -e "s/\(.*\)\/.*$/\1/g"

    cd ${COMMAND_PATH}

    cd to directory, otherwise ganttproject-eclipsito-config.xml will not be found

    cd "$GP_HOME"

    LOCAL_CLASSPATH="./eclipsito.jar"

    CONFIGURATION_FILE="ganttproject-eclipsito-config.xml"
    BOOT_CLASS=org.bardsoftware.eclipsito.Boot
    LOG_FILE=$HOME/.ganttproject.log

    if [ -z $JAVA_HOME ]; then
    JAVA_COMMAND=which java
    if [ "$?" = "1" ]; then
    echo "No executable java found. Please set JAVA_HOME variable";
    exit;
    fi
    else
    JAVA_COMMAND=$JAVA_HOME/bin/java
    fi
    if [ ! -x $JAVA_COMMAND ]; then
    echo "$JAVA_COMMAND is not executable. Please check the permissions."
    exit
    fi

    if [ -e $LOG_FILE ] && [ ! -w $LOG_FILE ]; then
    echo "Log file $LOG_FILE is not writable"
    exit
    fi

    if [ "$DEBUG" == "true" ]
    then
    echo $JAVA_COMMAND -Xmx256m -classpath $CLASSPATH:$LOCAL_CLASSPATH $BOOT_CLASS $CONFIGURATION_FILE -log $LOG_FILE "$@"
    fi

    $JAVA_COMMAND -Xmx256m -classpath $CLASSPATH:$LOCAL_CLASSPATH $BOOT_CLASS $CONFIGURATION_FILE -log $LOG_FILE "$@"

     
  • Scott Michel
    Scott Michel
    2012-07-09

    The proposed patch would break "in-place" execution of ganttproject. Also, not all platforms have the 'readlink' command (are you sure you really want to follow the symbolic link references?)

    Currently, I've had to modify ganttproject so that the class path found by ${GP_HOME} includes the dist-bin subdirectory, i.e.:

    diff -r 8091b35479c9 ganttproject-builder/ganttproject
    --- a/ganttproject-builder/ganttproject Tue Jul 03 15:34:45 2012 +0400
    +++ b/ganttproject-builder/ganttproject Mon Jul 09 10:39:58 2012 -0700
    @@ -44,7 +44,7 @@
    exit 1
    fi

    -LOCAL_CLASSPATH=${GP_HOME}/eclipsito.jar:${GP_HOME}
    +LOCAL_CLASSPATH=${GP_HOME}/dist-bin/eclipsito.jar:${GP_HOME}/dist-bin
    CONFIGURATION_FILE=ganttproject-eclipsito-config.xml
    BOOT_CLASS=org.bardsoftware.eclipsito.Boot

     
  • You don't need dist-bin in the classpath. You just need to run ganttproject script which sits in dist-bin/. dist-bin is what subsequently is zipped into zip distribution.

    readlink doesn't work the way we want on Mac but that's a minor problem.

    This issue tracker is deprecated, please use issue tracker on Google Code: http://code.google.com/p/ganttproject/issues/list

     


Anonymous


Cancel   Add attachments