3 # Modified from: Aaron Voisine <aaron@voisine.org>
6 TMP=/tmp/$(id -ru)/TemporaryItems
8 version=`sw_vers -productVersion`
9 if [ "$?" = "0" ]; then
26 # if 10.5 or greater, then all the open-x11 stuff need not occur
27 if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
28 version=`sw_vers -productVersion`
29 if [ "$?" = "0" ]; then
46 # if 10.5 or greater, then all the open-x11 stuff need not occur
47 if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
48 ps -wx -ocommand | grep -e '[X]11.app' > /dev/null
49 if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
50 echo "rm -f ~/.xinitrc" > ~/.xinitrc
51 sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
55 cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh"
59 if [ "\$DISPLAY"x = "x" ]; then
60 echo :0 > "$TMP/display"
62 echo \$DISPLAY > "$TMP/display"
64 __END_OF_GETDISPLAY_SCRIPT__
66 chmod +x "$TMP/getdisplay.sh"
68 open-x11 $TMP/getdisplay.sh || \
69 open -a XDarwin $TMP/getdisplay.sh || \
70 echo ":0" > $TMP/display
72 while [ "$?" = "0" -a ! -f $TMP/display ];
74 #echo "Waiting for display $TMP/display"
77 export "DISPLAY=`cat $TMP/display`"
79 ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
82 echo "$@" > /tmp/arguments.log
83 if echo $1 | grep -- "^-psn_"; then
87 exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1