Revision 1908 tmp/org.txm.setups/shared/mac/Applications/TXM.app/Contents/MacOS/TXM

TXM (revision 1908)
18 18
echo "Creating all necessary directories"
19 19

  
20 20
TXMHOME="$HOME/TXM-$VERSION"
21
DOTTXMHOME="$HOME/.TXM-$VERSION"
21 22
echo "TXMHOME='$TXMHOME'"
22 23
if [ ! -d "$TXMHOME" ]; then
23 24
	mkdir "$TXMHOME"
......
28 29
	exit 1
29 30
fi
30 31

  
31
DIR="$TXMHOME/.txm"
32
echo "DIR='$DIR'"
33
if [ ! -d "$DIR" ]; then
34
	mkdir "$DIR"
32

  
33
echo "DOTTXMHOME='$DOTTXMHOME'"
34
if [ ! -d "$DOTTXMHOME" ]; then
35
	mkdir "$DOTTXMHOME"
35 36
fi
36
if [ ! -d "$DIR" ]; then
37
	zenity --info --text="TXM: Impossible to access '$DIR' directory. Aborting$LOGFILESMSG"
38
	echo "TXM: Impossible to access '$DIR' directory. Aborting$LOGFILESMSG"
37
if [ ! -d "$DOTTXMHOME" ]; then
38
	zenity --info --text="TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG"
39
	echo "TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG"
39 40
	exit 1
40 41
fi
41 42
LOGFILES=", see log files $HOME/TXMPostInstallLogs.txt and $HOME/TXMPostInstallErrorLogs.txt."
42 43

  
43
vercomp () {
44
    echo "test $1 $2"
45
    if [[ $1 == $2 ]]
46
    then
47
        return 0
48
    fi
49
    local IFS=.
50
    local i ver1=($1) ver2=($2)
51
    # fill empty fields in ver1 with zeros
52
    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
53
    do
54
        ver1[i]=0
55
    done
56
    for ((i=0; i<${#ver1[@]}; i++))
57
    do
58
        if [[ -z ${ver2[i]} ]]
59
        then
60
            ver2[i]=0
61
        fi
62
        if ((10#${ver1[i]} > 10#${ver2[i]}))
63
        then
64
            return 0
65
        fi
66
        if ((10#${ver1[i]} < 10#${ver2[i]}))
67
        then
68
            return 1
69
        fi
70
    done
71
    return 0
72
}
44
echo "TXM: looking at the last TXM install date from the /Applications/TXM-TXMVERSION.app/STAMP file"
73 45

  
74

  
75
echo "TXM: looking at the last TXM install date from the /usr/lib/TXM/STAMP file"
76

  
77 46
if [ ! -f "/Applications/TXM-TXMVERSION.app/STAMP" ]; then
78 47
	echo "TXM: Impossible to access '/Applications/TXM-TXMVERSION.app/STAMP' file. Aborting$LOGFILESMSG"
79 48
	exit 1
......
87 56
fi
88 57

  
89 58
echo "TXM: if .txm folder does not contain the STAMP file, its a new install."
90
if [ ! -e "$TXMHOME/.txm/$STAMP" ]; then
59
if [ ! -e "$DOTTXMHOME/$STAMP" ]; then
91 60

  
92 61
	echo "New TXM install: it's the first launch after the installation"
93 62
	if [ -f "/tmp/org.txm.rcpapplication.prefs" ]; then
......
113 82
	fi
114 83

  
115 84
	echo "TXM: Installing up to date TXM directories."
116
	rm -rf "$TXMHOME/.txm"
117
	if [ -d "$TXMHOME/.txm" ]; then
118
	    echo "TXM: Failed to remove $TXMHOME/.txm directory$LOGFILESMSG"
85
	rm -rf "$DOTTXMHOME"
86
	if [ -d "$DOTTXMHOME" ]; then
87
	    echo "TXM: Failed to remove $DOTTXMHOME directory$LOGFILESMSG"
119 88
	    exit 1 ;
120 89
	fi
121 90

  
122
    mkdir "$TXMHOME/.txm"
123
	mkdir "$TXMHOME/.txm/user"
124
	mkdir "$TXMHOME/.txm/data"
91
    mkdir "$DOTTXMHOME"
92
	mkdir "$DOTTXMHOME/user"
93
	mkdir "$DOTTXMHOME/data"
125 94

  
126
    if [ ! -d "$TXMHOME/.txm" ]; then
127
		echo "TXM: Impossible to access '$TXMHOME/.txm' directory. Aborting$LOGFILESMSG"
95
    if [ ! -d "$DOTTXMHOME" ]; then
96
		echo "TXM: Impossible to access '$DOTTXMHOME' directory. Aborting$LOGFILESMSG"
128 97
		exit 1
129 98
    fi
130 99
    
......
135 104
	    exit 1 ;
136 105
	fi
137 106

  
138
    echo "TXM: getting '/Applications/TXM-TXMVERSION.app/TXM.ini' and set write permission of '$TXMHOME/.txm/TXM.ini'"
139
    cp "/Applications/TXM-TXMVERSION.app/Contents/TXM/TXM.ini" "$TXMHOME/.txm/TXM.ini" &&
140
    chmod +w "$TXMHOME/.txm/TXM.ini";
107
    echo "TXM: getting '/Applications/TXM-TXMVERSION.app/TXM.ini' and set write permission of '$DOTTXMHOME/TXM.ini'"
108
    cp "/Applications/TXM-TXMVERSION.app/Contents/TXM/TXM.ini" "$DOTTXMHOME/TXM.ini" &&
109
    chmod +w "$DOTTXMHOME/TXM.ini";
141 110
    
142 111
    if [ $? != 0 ]; then
143
       	echo "TXM: Can't launch TXM: failed to set TXM.ini file$LOGFILESMSG"
112
       	echo "TXM: Can't launch TXM: failed to copy TXM.ini file$LOGFILESMSG"
144 113
        exit 1
145 114
    fi
146 115

  
147
    echo "TXM: creating the $TXMHOME/.txm/$STAMP install STAMP file."
148
    touch "$TXMHOME/.txm/$STAMP"
116
    echo "TXM: creating the $DOTTXMHOME/$STAMP install STAMP file."
117
    touch "$DOTTXMHOME/$STAMP"
149 118

  
150 119
    if [ $? != 0 ]; then
151
		echo "TXM: Can't launch TXM: failed to create the $TXMHOME/.txm/$STAMP install STAMP file$LOGFILESMSG"
120
		echo "TXM: Can't launch TXM: failed to create the $DOTTXMHOME/$STAMP install STAMP file$LOGFILESMSG"
152 121
        exit 1
153 122
    fi
154 123
fi
......
174 143
	if [ $i == "-vmargs" ]; then
175 144
 	   STARTVMARGS=1
176 145
	fi
177
done < "$TXMHOME/.txm/TXM.ini"; 
146
done < "$DOTTXMHOME/TXM.ini"; 
178 147

  
179 148
echo "TXM INI ARGS = $TXMINIARGS"
180 149
echo "TXM INI VM ARGS = $TXMINIARGSVM"
181 150

  
182 151
OSVERSION=`sw_vers -productVersion`
183 152

  
184
vercomp $OSVERSION "10.7"
185

  
186
#if [ $? != 0 ];then
187
#	echo "TXM: Running TXM for Mac OS X $OSVERSION with the binary launcher..."
188
#	open "/Applications/TXM-TXMVERSION.app" --args -run --launcher.ini "$TXMHOME/.txm/TXM.ini" -data "$TXMHOME/.txm/data" -user "$TXMHOME/.txm/user" -install "/Applications/TXM-TXMVERSION.app" &
189
#else
190
	echo "TXM: Running TXM for Mac OS X $OSVERSION with the JAR launcher..."
191
	/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 -consoleLog -showsplash -run -data "$TXMHOME/corpora" -user "$TXMHOME/.txm/user" -install "/Applications/TXM-TXMVERSION.app/Contents/TXM"
192
#fi
153
echo "TXM: Running TXM for Mac OS X $OSVERSION with the JAR launcher..."
154
/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 -consoleLog -showsplash -run --launcher.ini "$DOTTXMHOME/TXM.ini" -configuration "$DOTTXMHOME/configuration" -user "$DOTTXMHOME/user" -install "/Applications/TXM-TXMVERSION.app/Contents/TXM"

Also available in: Unified diff