2007-01-10 23:30:26 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Modified from: Aaron Voisine <aaron@voisine.org>
|
|
|
|
|
|
|
|
CWD="`dirname \"$0\"`"
|
2009-10-10 00:11:47 +04:00
|
|
|
TMP=/tmp/$(id -ru)/TemporaryItems
|
2007-01-10 23:30:26 +03:00
|
|
|
|
2009-01-21 19:54:30 +03:00
|
|
|
version=`sw_vers -productVersion`
|
2009-10-10 00:11:47 +04:00
|
|
|
if [ "$?" = "0" ]; then
|
2009-01-21 19:54:30 +03:00
|
|
|
major=${version%%\.*}
|
|
|
|
rest=${version#*\.}
|
|
|
|
minor=${rest%%\.*}
|
|
|
|
build=${rest#*\.}
|
|
|
|
else
|
|
|
|
major=10
|
|
|
|
minor=4
|
|
|
|
build=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $version
|
|
|
|
echo "Major = $major"
|
|
|
|
echo "Minor = $minor"
|
|
|
|
echo "Build = $build"
|
|
|
|
|
|
|
|
|
|
|
|
# if 10.5 or greater, then all the open-x11 stuff need not occur
|
2009-10-10 00:11:47 +04:00
|
|
|
if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
|
2008-04-11 18:41:28 +04:00
|
|
|
version=`sw_vers -productVersion`
|
2008-06-09 23:50:11 +04:00
|
|
|
if [ "$?" = "0" ]; then
|
2008-04-11 18:41:28 +04:00
|
|
|
major=${version%%\.*}
|
|
|
|
rest=${version#*\.}
|
|
|
|
minor=${rest%%\.*}
|
|
|
|
build=${rest#*\.}
|
|
|
|
else
|
|
|
|
major=10
|
|
|
|
minor=4
|
|
|
|
build=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $version
|
|
|
|
echo "Major = $major"
|
|
|
|
echo "Minor = $minor"
|
|
|
|
echo "Build = $build"
|
|
|
|
|
|
|
|
|
|
|
|
# if 10.5 or greater, then all the open-x11 stuff need not occur
|
2009-10-10 00:11:47 +04:00
|
|
|
if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
|
2007-01-10 23:30:26 +03:00
|
|
|
ps -wx -ocommand | grep -e '[X]11.app' > /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
|
|
|
|
|
|
|
|
mkdir -p $TMP
|
|
|
|
cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh"
|
|
|
|
#!/bin/sh
|
|
|
|
mkdir -p "$TMP"
|
|
|
|
|
2008-06-09 23:50:11 +04:00
|
|
|
if [ "\$DISPLAY"x = "x" ]; then
|
2007-01-10 23:30:26 +03:00
|
|
|
echo :0 > "$TMP/display"
|
|
|
|
else
|
|
|
|
echo \$DISPLAY > "$TMP/display"
|
|
|
|
fi
|
|
|
|
__END_OF_GETDISPLAY_SCRIPT__
|
2009-01-21 19:54:30 +03:00
|
|
|
fi
|
2007-01-11 02:33:03 +03:00
|
|
|
chmod +x "$TMP/getdisplay.sh"
|
2007-01-10 23:30:26 +03:00
|
|
|
rm -f $TMP/display
|
|
|
|
open-x11 $TMP/getdisplay.sh || \
|
|
|
|
open -a XDarwin $TMP/getdisplay.sh || \
|
|
|
|
echo ":0" > $TMP/display
|
|
|
|
|
2008-06-09 23:50:11 +04:00
|
|
|
while [ "$?" = "0" -a ! -f $TMP/display ];
|
2007-01-11 02:33:03 +03:00
|
|
|
do
|
|
|
|
#echo "Waiting for display $TMP/display"
|
|
|
|
sleep 1;
|
|
|
|
done
|
2007-01-10 23:30:26 +03:00
|
|
|
export "DISPLAY=`cat $TMP/display`"
|
|
|
|
|
|
|
|
ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
|
|
|
|
|
|
|
|
cd ~/
|
|
|
|
echo "$@" > /tmp/arguments.log
|
|
|
|
if echo $1 | grep -- "^-psn_"; then
|
|
|
|
shift
|
|
|
|
fi
|
2008-04-11 18:41:28 +04:00
|
|
|
fi
|
2007-01-10 23:30:26 +03:00
|
|
|
exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1
|