Changeset 39326


Ignore:
Timestamp:
Sep 29, 2009, 6:36:06 AM (15 years ago)
Author:
marisn
Message:

Provide terminal if GRASS is started without it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/branches/develbranch_6/lib/init/grass.src

    r31958 r39326  
    2323export GISBASE
    2424
    25 exec "$GISBASE/etc/Init.sh" "$@"
     25GISRCRC="$HOME/.grassrc6"
     26
     27if [ -n "$GRASS_BATCH_JOB" ] ; then
     28        exec "$GISBASE/etc/Init.sh" "$@"
     29fi
     30
     31if test -t 0; then
     32        # We are running from some terminal (i.e. xterm).
     33        exec "$GISBASE/etc/Init.sh" "$@"
     34else
     35        # We are running headless...
     36        if [ ! -f "$GISRCRC" ] ; then
     37                # First time user...
     38                ( exec xdg-terminal -e $0 "$@" ) &>/dev/null
     39                # If there is no xdg-terminal, then fall back to xterm
     40                ( exec xterm -e $0 "$@" ) &>/dev/null
     41        else
     42                # Returning user may have preffered GRASS terminal application
     43                GRASS_XTERM=`awk '/GRASS_XTERM/ {print $2}' "$GISRCRC"  2>/dev/null`
     44                if [ -n "$GRASS_XTERM" ]; then
     45                        # User has preffered GRASS terminal app
     46                        ( exec $GRASS_XTERM -e $0 "$@" ) &>/dev/null
     47                else
     48                        # Starting user's preffered terminal app
     49                        ( exec xdg-terminal -e $0 "$@" ) &>/dev/null
     50                        # If there is no xdg-terminal, then fall back to xterm
     51                        ( exec xterm -e $0 "$@" ) &>/dev/null
     52                fi;
     53        fi;
     54fi;
     55
     56exit 1; # If we got so far, it's an error.
     57
Note: See TracChangeset for help on using the changeset viewer.