root / tmp / org.txm.setups / shared / mac / Applications / TXM.app / Contents / MacOS / TXM @ 2813
History | View | Annotate | Download (5.7 kB)
1 |
#!/bin/sh |
---|---|
2 |
# This script launch TXM in the right directory and with the right TXM.ini file |
3 |
|
4 |
echo "Preparing redirections in $HOME/TXMPostInstallOutputLogs.txt and $HOME/TXMPostInstallErrorLogs.txt files" |
5 |
|
6 |
LOGFILESMSG=", see $HOME/TXMPostInstallOutputLogs.txt and $HOME/TXMPostInstallErrorLogs.txt output and error messages files." |
7 |
VERSION=TXMMAJORVERSION |
8 |
exec 3>$HOME/TXMPostInstallOutputLogs.txt |
9 |
exec 4>$HOME/TXMPostInstallErrorLogs.txt |
10 |
|
11 |
echo "$HOME is '$HOME'" |
12 |
|
13 |
if [ ! -d "$HOME" ]; then |
14 |
echo "TXM: Impossible to access user home directory ($HOME). Aborting" |
15 |
exit 1 |
16 |
fi |
17 |
|
18 |
echo "Creating all necessary directories" |
19 |
|
20 |
TXMHOME="$HOME/TXM-$VERSION" |
21 |
DOTTXMHOME="$HOME/.TXM-$VERSION" |
22 |
echo "TXMHOME='$TXMHOME'" |
23 |
if [ ! -d "$TXMHOME" ]; then |
24 |
mkdir "$TXMHOME" |
25 |
fi |
26 |
if [ ! -d "$TXMHOME" ]; then |
27 |
zenity --info --text="TXM: Impossible to access '$TXMHOME' directory. Aborting$LOGFILESMSG" |
28 |
echo "TXM: Impossible to access '$DIR' directory. Aborting$LOGFILESMSG" |
29 |
exit 1 |
30 |
fi |
31 |
( |
32 |
echo "DOTTXMHOME='$DOTTXMHOME'" |
33 |
if [ ! -d "$DOTTXMHOME" ]; then |
34 |
mkdir "$DOTTXMHOME" |
35 |
fi |
36 |
if [ ! -d "$DOTTXMHOME" ]; then |
37 |
zenity --info --text="TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG" |
38 |
echo "TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG" |
39 |
exit 1 |
40 |
fi |
41 |
LOGFILES=", see log files $HOME/TXMPostInstallLogs.txt and $HOME/TXMPostInstallErrorLogs.txt." |
42 |
|
43 |
echo "TXM: looking at the last TXM install date from the /Applications/TXM-TXMVERSION.app/STAMP file" |
44 |
|
45 |
if [ ! -f "/Applications/TXM-TXMVERSION.app/STAMP" ]; then |
46 |
echo "TXM: Impossible to access '/Applications/TXM-TXMVERSION.app/STAMP' file. Aborting$LOGFILESMSG" |
47 |
exit 1 |
48 |
fi |
49 |
|
50 |
STAMP=`stat -t %Y-%m-%d_%H:%M "/Applications/TXM-TXMVERSION.app/STAMP" | cut -d\ -f11` |
51 |
|
52 |
if [ $? != 0 ]; then |
53 |
echo "TXM: Can't find STAMP file /Applications/TXM-TXMVERSION.app/STAMP $LOGFILES" |
54 |
exit 1 ; |
55 |
fi |
56 |
|
57 |
echo "TXM: if the $DOTTXMHOME/$STAMP STAMP file does not exists, its a new install." |
58 |
if [ ! -e "$DOTTXMHOME/$STAMP" ]; then |
59 |
|
60 |
echo "New TXM install: it's the first launch after the installation" |
61 |
if [ -f "/tmp/org.txm.rcpapplication.prefs" ]; then |
62 |
rm -f "/tmp/org.txm.rcpapplication.prefs" # remove previous preference files if any |
63 |
fi |
64 |
|
65 |
echo "Backing up previous TXM 0.7.6 preferences if any..." |
66 |
if [ -f "$HOME/.txm/configuration/.settings/org.txm.rcpapplication.prefs" ]; then |
67 |
echo "Found preference file: $HOME/.txm/configuration/.settings/org.txm.rcpapplication.prefs" |
68 |
cp -f "$HOME/.txm/configuration/.settings/org.txm.rcpapplication.prefs" "/tmp/org.txm.rcpapplication.prefs" |
69 |
if [ $? != 0 ]; then |
70 |
echo "Failed to copy old preference file in /tmp/org.txm.rcpapplication.prefs" |
71 |
fi |
72 |
fi |
73 |
|
74 |
echo "Backing up previous TXM 0.7.7 preferences if any..." |
75 |
if [ -f "$HOME/.txm/data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.txm.rcpapplication.prefs" ]; then |
76 |
echo "Found preference file: $HOME/.txm/data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.txm.rcpapplication.prefs" |
77 |
cp -f "$HOME/.txm/data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.txm.rcpapplication.prefs" "/tmp/org.txm.rcpapplication.prefs" |
78 |
if [ $? != 0 ]; then |
79 |
echo "Failed to copy old preference file in /tmp/org.txm.rcpapplication.prefs" |
80 |
fi |
81 |
fi |
82 |
|
83 |
echo "TXM: Installing up to date TXM directories." |
84 |
rm -rf "$DOTTXMHOME" |
85 |
if [ -d "$DOTTXMHOME" ]; then |
86 |
echo "TXM: Failed to remove $DOTTXMHOME directory$LOGFILESMSG" |
87 |
exit 1 ; |
88 |
fi |
89 |
|
90 |
mkdir "$DOTTXMHOME" |
91 |
mkdir "$DOTTXMHOME/user" |
92 |
mkdir "$DOTTXMHOME/configuration" |
93 |
|
94 |
if [ ! -d "$DOTTXMHOME" ]; then |
95 |
echo "TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG" |
96 |
exit 1 |
97 |
fi |
98 |
|
99 |
echo "TXM: resetting RCP workspace." |
100 |
rm -rf "$TXMHOME/.metadata" |
101 |
if [ -d "$TXMHOME/.metadata" ]; then |
102 |
echo "TXM: Failed to remove $TXMHOME/.metadata" |
103 |
exit 1 ; |
104 |
fi |
105 |
|
106 |
echo "TXM: getting '/Applications/TXM-TXMVERSION.app/TXM.ini' and set write permission of '$DOTTXMHOME/TXM.ini'" |
107 |
cp "/Applications/TXM-TXMVERSION.app/Contents/TXM/TXM.ini" "$DOTTXMHOME/TXM.ini" && |
108 |
chmod +w "$DOTTXMHOME/TXM.ini"; |
109 |
|
110 |
if [ $? != 0 ]; then |
111 |
echo "TXM: Can't launch TXM: failed to copy TXM.ini file$LOGFILESMSG" |
112 |
exit 1 |
113 |
fi |
114 |
|
115 |
echo "TXM: creating the $DOTTXMHOME/$STAMP install STAMP file." |
116 |
touch "$DOTTXMHOME/$STAMP" |
117 |
|
118 |
if [ $? != 0 ]; then |
119 |
echo "TXM: Can't launch TXM: failed to create the $DOTTXMHOME/$STAMP install STAMP file$LOGFILESMSG" |
120 |
exit 1 |
121 |
fi |
122 |
fi |
123 |
|
124 |
|
125 |
|
126 |
# don't exec TXM if problem occurs |
127 |
if [ $? != 0 ]; then |
128 |
echo "TXM: An error occurred. Aborting$LOGFILESMSG"; |
129 |
exit 1 ; |
130 |
fi |
131 |
|
132 |
TXMINIARGSVM="" |
133 |
TXMINIARGS="" |
134 |
STARTVMARGS=0 |
135 |
while read i ; do |
136 |
if [ $STARTVMARGS == 1 ]; then |
137 |
TXMINIARGSVM="$TXMINIARGSVM $i" ; |
138 |
else |
139 |
TXMINIARGS="$TXMINIARGS $i" ; |
140 |
fi |
141 |
|
142 |
if [ $i == "-vmargs" ]; then |
143 |
STARTVMARGS=1 |
144 |
fi |
145 |
done < "$DOTTXMHOME/TXM.ini"; |
146 |
|
147 |
echo "TXM INI ARGS = $TXMINIARGS" |
148 |
echo "TXM INI VM ARGS = $TXMINIARGSVM" |
149 |
|
150 |
OSVERSION=`sw_vers -productVersion` |
151 |
|
152 |
echo "TXM: Running TXM for Mac OS X $OSVERSION with the JAR launcher..." |
153 |
) 1>&3 2>&4 |
154 |
|
155 |
echo "Starting TXM with --launcher.ini '$DOTTXMHOME/TXM.ini' -configuration '$DOTTXMHOME/configuration' -user '$DOTTXMHOME/user' -install '/Applications/TXM-TXMVERSION.app/Contents/TXM'" |
156 |
/Applications/TXM-TXMVERSION.app/Contents/TXM/jre/Contents/Home/bin/java -Djava.library.path="$(echo /Applications/TXM-TXMVERSION.app/Contents/TXM/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_*/eclipse_*.so)" -XX:MaxPermSize=256m -XstartOnFirstThread $TXMINIARGSVM -jar "$(echo /Applications/TXM-TXMVERSION.app/Contents/TXM/plugins/org.eclipse.equinox.launcher_*.jar)" -os macosx -ws cocoa -arch x86_64 -showsplash -run --launcher.ini "$DOTTXMHOME/TXM.ini" -configuration "$DOTTXMHOME/configuration" -user "$DOTTXMHOME/user" -install "/Applications/TXM-TXMVERSION.app/Contents/TXM" |