Statistiques
| Révision :

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

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

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