Statistiques
| Révision :

root / tmp / org.txm.setups / shared / mac / INSTALL @ 811

Historique | Voir | Annoter | Télécharger (3,96 ko)

1
#!/bin/sh
2

    
3
vercomp () {
4
    echo "test $1 $2"
5
    if [[ $1 == $2 ]]
6
    then
7
        return 0
8
    fi
9
    local IFS=.
10
    local i ver1=($1) ver2=($2)
11
    # fill empty fields in ver1 with zeros
12
    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
13
    do
14
        ver1[i]=0
15
    done
16
    for ((i=0; i<${#ver1[@]}; i++))
17
    do
18
        if [[ -z ${ver2[i]} ]]
19
        then
20
            ver2[i]=0
21
        fi
22
        if ((10#${ver1[i]} > 10#${ver2[i]}))
23
        then
24
            return 0
25
        fi
26
        if ((10#${ver1[i]} < 10#${ver2[i]}))
27
        then
28
            return 1
29
        fi
30
    done
31
    return 0
32
}
33

    
34
# messages en and fr
35
SAY_STARTINSTALL_EN="starting post installation"
36
SAY_INSTALLR_EN="installing R and R dependancies"
37
SAY_CREATESTAMP_EN="creating STAMP"
38
SAY_SETFILERIGHTS_EN="setting file rights"
39
SAY_DONE_EN="Done"
40

    
41
SAY_STARTINSTALL_FR="Début de la post-installation de TXM"
42
SAY_INSTALLR_FR="Installation de R et ses dépendances"
43
SAY_CREATESTAMP_FR="Création du fichier STAMP"
44
SAY_SETFILERIGHTS_FR="Réglage des droits de fichiers"
45
SAY_DONE_FR="Installation terminée"
46

    
47
if [ $LANG = "fr_FR.UTF-8" ];then
48
	SAY_STARTINSTALL=$SAY_STARTINSTALL_FR
49
	SAY_INSTALLR=$SAY_INSTALLR_FR
50
	SAY_CREATESTAMP=$SAY_CREATESTAMP_FR
51
	SAY_SETFILERIGHTS=$SAY_SETFILERIGHTS_FR
52
	SAY_DONE=$SAY_DONE_FR
53
else
54
	SAY_STARTINSTALL=$SAY_STARTINSTALL_EN
55
	SAY_INSTALLR=$SAY_INSTALLR_EN
56
	SAY_CREATESTAMP=$SAY_CREATESTAMP_EN
57
	SAY_SETFILERIGHTS=$SAY_SETFILERIGHTS_EN
58
	SAY_DONE=$SAY_DONE_EN
59
fi
60

    
61
OSVERSION=`sw_vers -productVersion`
62
echo "MAC OS X Version is : $OSVERSION"
63
vercomp $OSVERSION "10.7"
64
if [ $? != 0 ];then
65
	java -version
66
	if [ $? != 0 ];then
67
		echo "** TXM postinstall: failed to install: java is missing."
68
		exit 1
69
	fi
70
fi
71

    
72
say $SAY_STARTINSTALL
73
echo "** TXM postinstall: start post installation"
74
TXMINSTALLDIR="/Applications/TXM"
75

    
76
# remove "try(library(textometrieR))" from .Rprofile if any
77
if [ -f "$HOME/.Rprofile" ]; then
78
	echo "Removing 'try(library(textometrieR))' from old .Rprofile"
79
	sed "s/try(library(textometrieR))//g" "$HOME/.Rprofile" > "$HOME/.Rprofile2" &&
80
	mv -f "$HOME/.Rprofile2" "$HOME/.Rprofile"
81
	if [ $? != 0 ];then
82
		echo "** TXM postinstall: failed to fix old '.Rprofile' file."
83
		exit 1
84
	fi
85
fi
86

    
87
say $SAY_INSTALLR
88
if [ ! -d "/usr/local/lib/tcl8" ]; then
89
	installer -pkg "$TXMINSTALLDIR/R/tcltk-8.5.5-x11.pkg" -allowUntrusted -target /
90
	if [ $? != 0 ]; then
91
			echo "** TXM install: installation of tcltk failed. Aborting."
92
			exit 1;
93
	fi
94
else 
95
	echo "Skipping tcl8 installation"
96
fi
97

    
98
if [ ! -d "/usr/local/share/texinfo" ]; then
99
	installer -pkg "$TXMINSTALLDIR/R/texinfo-6.1-0.pkg" -allowUntrusted -target /
100
	if [ $? != 0 ]; then
101
			echo "** TXM install: installation of texinfo failed. Aborting."
102
			exit 1;
103
	fi
104
else 
105
	echo "Skipping Texinfo installation"
106
fi
107

    
108
if [ ! -d "/opt/X11/bin" ]; then
109
	installer -pkg "$TXMINSTALLDIR/R/XQuartz.pkg" -allowUntrusted -target /
110
	if [ $? != 0 ]; then
111
			echo "** TXM install: installation of XQuartz failed. Aborting."
112
			exit 1;
113
	fi
114
else 
115
	echo "Skipping XQartz installation"
116
fi
117

    
118
tar xzf "$TXMINSTALLDIR/R/R.tar.gz" -C "$TXMINSTALLDIR/R"
119
if [ $? != 0 ]; then
120
		echo "** TXM install: failed to extract R binaries. Aborting."
121
		exit 1;
122
fi
123

    
124
say $SAY_CREATESTAMP
125
echo "** TXM postinstall: create STAMP file"
126
# Create STAMP
127
touch "$TXMINSTALLDIR/STAMP"
128

    
129
if [ $? != 0 ];then
130
	echo "** TXM postinstall: failed to create STAMP file."
131
	exit 1
132
fi
133

    
134
say $SAY_SETFILERIGHTS
135
echo "** TXM postinstall: set rights"
136
# Set executable files
137
chmod -R +rx "$TXMINSTALLDIR/cwb/bin"
138
chmod +x "$TXMINSTALLDIR"/TXM/plugins/CQP.macosx*/res/macosx/*
139

    
140
chmod -R +r "$TXMINSTALLDIR"
141
chmod +rx "$TXMINSTALLDIR/TXM.app/Contents/MacOS/TXM"
142
chmod -R +rx /opt/local/lib
143

    
144
echo "sudo chown -R $USER $TXMINSTALLDIR"
145
sudo chown -R "$USER" "$TXMINSTALLDIR"
146

    
147
if [ $? != 0 ];then
148
	echo "** TXM postinstall: failed to set permissions."
149
	exit 1
150
fi
151

    
152
#check created directories
153
if [ ! -d "/opt/local/lib" ]; then
154
	echo "** TXM postinstall: failed to create /opt/local/lib directory. User has not enough rights?"
155
	exit 1
156
fi
157

    
158
say $SAY_DONE
159
echo "** TXM postinstall: Done"