Ticket #16516: script

File script, 1013 bytes (added by dershow, 16 years ago)

A new version of the gimp-app script

Line 
1#!/bin/sh
2#
3# Author: Aaron Voisine <aaron@voisine.org>
4
5CWD="/opt/local"
6
7# System version: 3 for Panther, 4 for Tiger, 5 for Leopard
8export VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
9
10# On Leopard, X11.app is installed by default, and will be started
11# automatically via launchd.  On older systems, we need to start
12# X11 ourself.
13
14# For Panther and Tiger, start X11
15if [[ $VERSION -le 4 ]]; then
16
17        ps -wx -ocommand | grep -e '[X]11' > /dev/null
18        if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
19                echo "rm -f ~/.xinitrc" > ~/.xinitrc
20                sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
21        fi
22       
23        cp -f "$CWD/bin/getdisplay.sh" /tmp/
24        rm -f /tmp/display.$UID
25        open-x11 /tmp/getdisplay.sh || \
26        open -a XDarwin /tmp/getdisplay.sh || \
27        echo ":0" > /tmp/display.$UID
28       
29        while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
30                sleep 1
31        done
32        export "DISPLAY=`cat /tmp/display.$UID`"
33       
34        ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
35
36fi
37
38cd ~/
39exec "$CWD/bin/gimp" "$@"