6
6
CWD="`dirname \"$0\"`"
8
ps -wx -ocommand | grep -e '[X]11' > /dev/null
9
if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
10
echo "rm -f ~/.xinitrc" > ~/.xinitrc
11
sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
14
cp -f "$CWD/bin/getdisplay.sh" /tmp/
15
rm -f /tmp/display.$UID
16
open-x11 /tmp/getdisplay.sh || \
17
open -a XDarwin /tmp/getdisplay.sh || \
18
echo ":0" > /tmp/display.$UID
20
while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
23
export DISPLAY="`cat /tmp/display.$UID`"
25
ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
8
# System version: 3 for Panther, 4 for Tiger, 5 for Leopard
27
9
VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
28
if [ "$VERSION" -eq "4" ]; then
29
# We're on tiger. So need to update fc-cache if it hasn't been done
30
test -f ~/.inkscape/.fccache || exit 12
12
# For Panther and Tiger, start X11
13
if [[ $VERSION -le 4 ]]; then
14
# FIXME apparently this removes the xterm that starts with X from xinitrc but when is it really used? Should we modify the .xinitrc of the user without warning?
15
ps -wx -ocommand | grep -e '[X]11' > /dev/null
16
if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
17
echo "rm -f ~/.xinitrc" > ~/.xinitrc
18
sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
21
# Start X11 and get DISPLAY
22
cp -f "$CWD/bin/getdisplay.sh" /tmp/
23
rm -f /tmp/display.$UID
24
open-x11 /tmp/getdisplay.sh || \
25
open -a XDarwin /tmp/getdisplay.sh || \
26
echo ":0" > /tmp/display.$UID
28
while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
31
export DISPLAY="`cat /tmp/display.$UID`"
33
ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
36
# In Leopard, X11 should start on itself
39
# Warn the user about time-consuming generation of fontconfig caches.
40
test -f ~/.inkscape/.fccache-new || exit 12
33
43
BASE="`echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//'`"
35
45
exec "$CWD/bin/inkscape" "$@"
46
# TODO examine wether it would be wisest to move the code from inkscape shell script and getdisplay.sh to here and only keep the real binary in bin. This may make things easier on Leopard and may also help using Inkscape on the command line
b'\\ No newline at end of file'