Statistiques
| Révision :

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

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

1 728 mdecorde
#!/bin/sh
2 728 mdecorde
3 728 mdecorde
vercomp () {
4 728 mdecorde
    echo "test $1 $2"
5 728 mdecorde
    if [[ $1 == $2 ]]
6 728 mdecorde
    then
7 728 mdecorde
        return 0
8 728 mdecorde
    fi
9 728 mdecorde
    local IFS=.
10 728 mdecorde
    local i ver1=($1) ver2=($2)
11 728 mdecorde
    # fill empty fields in ver1 with zeros
12 728 mdecorde
    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
13 728 mdecorde
    do
14 728 mdecorde
        ver1[i]=0
15 728 mdecorde
    done
16 728 mdecorde
    for ((i=0; i<${#ver1[@]}; i++))
17 728 mdecorde
    do
18 728 mdecorde
        if [[ -z ${ver2[i]} ]]
19 728 mdecorde
        then
20 728 mdecorde
            ver2[i]=0
21 728 mdecorde
        fi
22 728 mdecorde
        if ((10#${ver1[i]} > 10#${ver2[i]}))
23 728 mdecorde
        then
24 728 mdecorde
            return 0
25 728 mdecorde
        fi
26 728 mdecorde
        if ((10#${ver1[i]} < 10#${ver2[i]}))
27 728 mdecorde
        then
28 728 mdecorde
            return 1
29 728 mdecorde
        fi
30 728 mdecorde
    done
31 728 mdecorde
    return 0
32 728 mdecorde
}
33 728 mdecorde
34 728 mdecorde
# messages en and fr
35 728 mdecorde
SAY_STARTINSTALL_EN="starting post installation"
36 728 mdecorde
SAY_INSTALLR_EN="installing R and R dependancies"
37 728 mdecorde
SAY_CREATESTAMP_EN="creating STAMP"
38 728 mdecorde
SAY_SETFILERIGHTS_EN="setting file rights"
39 728 mdecorde
SAY_DONE_EN="Done"
40 728 mdecorde
41 728 mdecorde
SAY_STARTINSTALL_FR="Début de la post-installation de TXM"
42 728 mdecorde
SAY_INSTALLR_FR="Installation de R et ses dépendances"
43 728 mdecorde
SAY_CREATESTAMP_FR="Création du fichier STAMP"
44 728 mdecorde
SAY_SETFILERIGHTS_FR="Réglage des droits de fichiers"
45 728 mdecorde
SAY_DONE_FR="Installation terminée"
46 728 mdecorde
47 728 mdecorde
if [ $LANG = "fr_FR.UTF-8" ];then
48 728 mdecorde
	SAY_STARTINSTALL=$SAY_STARTINSTALL_FR
49 728 mdecorde
	SAY_INSTALLR=$SAY_INSTALLR_FR
50 728 mdecorde
	SAY_CREATESTAMP=$SAY_CREATESTAMP_FR
51 728 mdecorde
	SAY_SETFILERIGHTS=$SAY_SETFILERIGHTS_FR
52 728 mdecorde
	SAY_DONE=$SAY_DONE_FR
53 728 mdecorde
else
54 728 mdecorde
	SAY_STARTINSTALL=$SAY_STARTINSTALL_EN
55 728 mdecorde
	SAY_INSTALLR=$SAY_INSTALLR_EN
56 728 mdecorde
	SAY_CREATESTAMP=$SAY_CREATESTAMP_EN
57 728 mdecorde
	SAY_SETFILERIGHTS=$SAY_SETFILERIGHTS_EN
58 728 mdecorde
	SAY_DONE=$SAY_DONE_EN
59 728 mdecorde
fi
60 728 mdecorde
61 728 mdecorde
OSVERSION=`sw_vers -productVersion`
62 728 mdecorde
echo "MAC OS X Version is : $OSVERSION"
63 728 mdecorde
vercomp $OSVERSION "10.7"
64 728 mdecorde
if [ $? != 0 ];then
65 728 mdecorde
	java -version
66 728 mdecorde
	if [ $? != 0 ];then
67 728 mdecorde
		echo "** TXM postinstall: failed to install: java is missing."
68 728 mdecorde
		exit 1
69 728 mdecorde
	fi
70 728 mdecorde
fi
71 728 mdecorde
72 728 mdecorde
say $SAY_STARTINSTALL
73 728 mdecorde
echo "** TXM postinstall: start post installation"
74 728 mdecorde
TXMINSTALLDIR="/Applications/TXM"
75 728 mdecorde
76 728 mdecorde
# remove "try(library(textometrieR))" from .Rprofile if any
77 728 mdecorde
if [ -f "$HOME/.Rprofile" ]; then
78 728 mdecorde
	echo "Removing 'try(library(textometrieR))' from old .Rprofile"
79 728 mdecorde
	sed "s/try(library(textometrieR))//g" "$HOME/.Rprofile" > "$HOME/.Rprofile2" &&
80 728 mdecorde
	mv -f "$HOME/.Rprofile2" "$HOME/.Rprofile"
81 728 mdecorde
	if [ $? != 0 ];then
82 728 mdecorde
		echo "** TXM postinstall: failed to fix old '.Rprofile' file."
83 728 mdecorde
		exit 1
84 728 mdecorde
	fi
85 728 mdecorde
fi
86 728 mdecorde
87 728 mdecorde
say $SAY_INSTALLR
88 728 mdecorde
if [ ! -d "/usr/local/lib/tcl8" ]; then
89 728 mdecorde
	installer -pkg "$TXMINSTALLDIR/R/tcltk-8.5.5-x11.pkg" -allowUntrusted -target /
90 728 mdecorde
	if [ $? != 0 ]; then
91 728 mdecorde
			echo "** TXM install: installation of tcltk failed. Aborting."
92 728 mdecorde
			exit 1;
93 728 mdecorde
	fi
94 728 mdecorde
else
95 728 mdecorde
	echo "Skipping tcl8 installation"
96 728 mdecorde
fi
97 728 mdecorde
98 728 mdecorde
if [ ! -d "/usr/local/share/texinfo" ]; then
99 728 mdecorde
	installer -pkg "$TXMINSTALLDIR/R/texinfo-6.1-0.pkg" -allowUntrusted -target /
100 728 mdecorde
	if [ $? != 0 ]; then
101 728 mdecorde
			echo "** TXM install: installation of texinfo failed. Aborting."
102 728 mdecorde
			exit 1;
103 728 mdecorde
	fi
104 728 mdecorde
else
105 728 mdecorde
	echo "Skipping Texinfo installation"
106 728 mdecorde
fi
107 728 mdecorde
108 728 mdecorde
if [ ! -d "/opt/X11/bin" ]; then
109 728 mdecorde
	installer -pkg "$TXMINSTALLDIR/R/XQuartz.pkg" -allowUntrusted -target /
110 728 mdecorde
	if [ $? != 0 ]; then
111 728 mdecorde
			echo "** TXM install: installation of XQuartz failed. Aborting."
112 728 mdecorde
			exit 1;
113 728 mdecorde
	fi
114 728 mdecorde
else
115 728 mdecorde
	echo "Skipping XQartz installation"
116 728 mdecorde
fi
117 728 mdecorde
118 728 mdecorde
tar xzf "$TXMINSTALLDIR/R/R.tar.gz" -C "$TXMINSTALLDIR/R"
119 728 mdecorde
if [ $? != 0 ]; then
120 728 mdecorde
		echo "** TXM install: failed to extract R binaries. Aborting."
121 728 mdecorde
		exit 1;
122 728 mdecorde
fi
123 728 mdecorde
124 728 mdecorde
say $SAY_CREATESTAMP
125 728 mdecorde
echo "** TXM postinstall: create STAMP file"
126 728 mdecorde
# Create STAMP
127 728 mdecorde
touch "$TXMINSTALLDIR/STAMP"
128 728 mdecorde
129 728 mdecorde
if [ $? != 0 ];then
130 728 mdecorde
	echo "** TXM postinstall: failed to create STAMP file."
131 728 mdecorde
	exit 1
132 728 mdecorde
fi
133 728 mdecorde
134 728 mdecorde
say $SAY_SETFILERIGHTS
135 728 mdecorde
echo "** TXM postinstall: set rights"
136 728 mdecorde
# Set executable files
137 728 mdecorde
chmod -R +rx "$TXMINSTALLDIR/cwb/bin"
138 728 mdecorde
chmod +x "$TXMINSTALLDIR"/TXM/plugins/CQP.macosx*/res/macosx/*
139 728 mdecorde
140 728 mdecorde
chmod -R +r "$TXMINSTALLDIR"
141 728 mdecorde
chmod +rx "$TXMINSTALLDIR/TXM.app/Contents/MacOS/TXM"
142 728 mdecorde
chmod -R +rx /opt/local/lib
143 728 mdecorde
144 728 mdecorde
echo "sudo chown -R $USER $TXMINSTALLDIR"
145 728 mdecorde
sudo chown -R "$USER" "$TXMINSTALLDIR"
146 728 mdecorde
147 728 mdecorde
if [ $? != 0 ];then
148 728 mdecorde
	echo "** TXM postinstall: failed to set permissions."
149 728 mdecorde
	exit 1
150 728 mdecorde
fi
151 728 mdecorde
152 728 mdecorde
#check created directories
153 728 mdecorde
if [ ! -d "/opt/local/lib" ]; then
154 728 mdecorde
	echo "** TXM postinstall: failed to create /opt/local/lib directory. User has not enough rights?"
155 728 mdecorde
	exit 1
156 728 mdecorde
fi
157 728 mdecorde
158 728 mdecorde
say $SAY_DONE
159 728 mdecorde
echo "** TXM postinstall: Done"