d689320d205f82ca7fd2443b20d3efe53ed4c424
[ardour.git] / tools / osx_packaging / script
1 #!/bin/sh
2 #
3 # Author: Aaron Voisine <aaron@voisine.org>
4
5 CWD="`dirname \"$0\"`"
6 TMP=/tmp/$UID/TemporaryItems
7
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
12 fi
13
14 mkdir -p $TMP
15 cp -f "$CWD/bin/getdisplay.sh" $TMP
16 rm -f $TMP/display
17 open-x11 $TMP/getdisplay.sh || \
18 open -a XDarwin $TMP/getdisplay.sh || \
19 echo ":0" > $TMP/display
20
21 while [ "$?" == "0" -a ! -f $TMP/display ]; do sleep 1; done
22 export "DISPLAY=`cat $TMP/display`"
23
24 ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
25
26 cd ~/
27 exec "$CWD/bin/exporter" "$@"