script revision eb378b70f3ab473cc4f54436070b48d3d8ddf86a
309N/A#!/bin/sh
309N/A#
1356N/A# Author: Aaron Voisine <aaron@voisine.org>
309N/A# Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net>
1356N/A
309N/ACWD="`dirname \"$0\"`"
309N/A
919N/A# System version: 3 for Panther, 4 for Tiger, 5 for Leopard
919N/AVERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
919N/A
919N/A
919N/A# For Panther and Tiger, start X11
919N/Aif [[ $VERSION -le 4 ]]; then
919N/A # 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?
919N/A ps -wx -ocommand | grep -e '[X]11' > /dev/null
919N/A if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
919N/A echo "rm -f ~/.xinitrc" > ~/.xinitrc
919N/A sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
919N/A fi
919N/A
919N/A # Start X11 and get DISPLAY
919N/A cp -f "$CWD/bin/getdisplay.sh" /tmp/
919N/A rm -f /tmp/display.$UID
919N/A open-x11 /tmp/getdisplay.sh || \
309N/A open -a XDarwin /tmp/getdisplay.sh || \
309N/A echo ":0" > /tmp/display.$UID
309N/A
309N/A while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
493N/A sleep 1
309N/A done
970N/A export DISPLAY="`cat /tmp/display.$UID`"
977N/A
970N/A ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
970N/Afi
1356N/A
1356N/A# In Leopard, X11 should start on itself
1356N/A
309N/A
1068N/A# Warn the user about time-consuming generation of fontconfig caches.
309N/Atest -f ~/.inkscape/.fccache-new || exit 12
911N/A
1068N/A
1068N/ABASE="`echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//'`"
911N/Acd "$BASE"
309N/Aexec "$CWD/bin/inkscape" "$@"
1068N/A# 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