blob: 1ce43bc7774fb45469dd60bbc689c2be5318b7cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
#
# Modified from: Aaron Voisine <aaron@voisine.org>
CWD="`dirname \"$0\"`"
TMP=/tmp/$UID/TemporaryItems
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"
if [ "\$DISPLAY"x == "x" ]; then
echo :0 > "$TMP/display"
else
echo \$DISPLAY > "$TMP/display"
fi
__END_OF_GETDISPLAY_SCRIPT__
chmod +x "$TMP/getdisplay.sh"
rm -f $TMP/display
open-x11 $TMP/getdisplay.sh || \
open -a XDarwin $TMP/getdisplay.sh || \
echo ":0" > $TMP/display
while [ "$?" == "0" -a ! -f $TMP/display ];
do
#echo "Waiting for display $TMP/display"
sleep 1;
done
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
exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1
|