File: script

package info (click to toggle)
gretl 2016d-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 48,620 kB
  • ctags: 22,779
  • sloc: ansic: 345,830; sh: 4,648; makefile: 2,712; xml: 570; perl: 364
file content (32 lines) | stat: -rwxr-xr-x 803 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
# Author: Aaron Voisine <aaron@voisine.org>

CWD="`dirname \"$0\"`"
echo "CWD=$CWD"

OSXVERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`

if [ "$OSXVERSION" -lt "5" ]; then
  ps -wx -ocommand | grep -e '[X]11' > /dev/null
  if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
    echo "rm -f ~/.xinitrc" > ~/.xinitrc
    sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
  fi

  cp -f "$CWD/bin/getdisplay.sh" /tmp/
  rm -f /tmp/display.$UID
  open-x11 /tmp/getdisplay.sh || \
  open -a XDarwin /tmp/getdisplay.sh || \
  echo ":0" > /tmp/display.$UID

  while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
    sleep 1
  done
  export "DISPLAY=`cat /tmp/display.$UID`"

  ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
fi  

exec "$CWD/bin/gretl" "$@"