root / tmp / org.txm.setups / shared / mac / INSTALL @ 1914
Historique | Voir | Annoter | Télécharger (2,83 ko)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
VERSION="-TXMVERSION" |
4 |
|
5 |
# messages en and fr |
6 |
SAY_STARTINSTALL_EN="starting post installation" |
7 |
SAY_INSTALLR_EN="installing R and R dependancies" |
8 |
SAY_CREATESTAMP_EN="creating STAMP" |
9 |
SAY_SETFILERIGHTS_EN="setting file rights" |
10 |
SAY_DONE_EN="Done" |
11 |
|
12 |
SAY_STARTINSTALL_FR="Début de la post-installation de TXM" |
13 |
SAY_INSTALLR_FR="Installation de R et ses dépendances" |
14 |
SAY_CREATESTAMP_FR="Création du fichier STAMP" |
15 |
SAY_SETFILERIGHTS_FR="Réglage des droits de fichiers" |
16 |
SAY_DONE_FR="Installation terminée" |
17 |
|
18 |
SAY_STARTINSTALL=$SAY_STARTINSTALL_EN |
19 |
SAY_INSTALLR=$SAY_INSTALLR_EN |
20 |
SAY_CREATESTAMP=$SAY_CREATESTAMP_EN |
21 |
SAY_SETFILERIGHTS=$SAY_SETFILERIGHTS_EN |
22 |
SAY_DONE=$SAY_DONE_EN |
23 |
|
24 |
|
25 |
say $SAY_STARTINSTALL |
26 |
echo "** TXM postinstall: start post installation" |
27 |
TXMINSTALLDIR="/Applications/TXM${VERSION}.app" |
28 |
|
29 |
# remove "try(library(textometrieR))" from .Rprofile if any |
30 |
if [ -f "$HOME/.Rprofile" ]; then |
31 |
echo "Removing 'try(library(textometrieR))' from old .Rprofile" |
32 |
sed "s/try(library(textometrieR))//g" "$HOME/.Rprofile" > "$HOME/.Rprofile2" && |
33 |
mv -f "$HOME/.Rprofile2" "$HOME/.Rprofile" |
34 |
if [ $? != 0 ];then |
35 |
echo "** TXM postinstall: failed to fix old '.Rprofile' file." |
36 |
exit 1 |
37 |
fi |
38 |
fi |
39 |
|
40 |
say $SAY_INSTALLR |
41 |
if [ ! -d "/usr/local/lib/tcl8" ]; then |
42 |
installer -pkg "$TXMINSTALLDIR/Contents/TXM/R/tcltk-8.5.5-x11.pkg" -allowUntrusted -target / |
43 |
if [ $? != 0 ]; then |
44 |
echo "** TXM install: installation of tcltk failed. Aborting." |
45 |
exit 1 |
46 |
fi |
47 |
else |
48 |
echo "Skipping tcl8 installation" |
49 |
fi |
50 |
|
51 |
if [ ! -d "/usr/local/share/texinfo" ]; then |
52 |
installer -pkg "$TXMINSTALLDIR/Contents/TXM/R/texinfo-6.1-0.pkg" -allowUntrusted -target / |
53 |
if [ $? != 0 ]; then |
54 |
echo "** TXM install: installation of texinfo failed. Aborting." |
55 |
exit 1 |
56 |
fi |
57 |
else |
58 |
echo "Skipping 'texinfo' installation" |
59 |
fi |
60 |
|
61 |
if [ ! -d "/opt/X11/bin" ]; then |
62 |
installer -pkg "$TXMINSTALLDIR/Contents/TXM/R/XQuartz.pkg" -allowUntrusted -target / |
63 |
if [ $? != 0 ]; then |
64 |
echo "** TXM install: installation of XQuartz failed. Aborting." |
65 |
exit 1 |
66 |
fi |
67 |
else |
68 |
echo "Skipping XQuartz installation" |
69 |
fi |
70 |
|
71 |
say $SAY_CREATESTAMP |
72 |
echo "** TXM postinstall: create STAMP file" |
73 |
# Create STAMP |
74 |
touch "$TXMINSTALLDIR/STAMP" |
75 |
|
76 |
if [ $? != 0 ];then |
77 |
echo "** TXM postinstall: failed to create STAMP file." |
78 |
exit 1 |
79 |
fi |
80 |
|
81 |
say $SAY_SETFILERIGHTS |
82 |
echo "** TXM postinstall: set rights" |
83 |
# Set executable files |
84 |
chmod +x "$TXMINSTALLDIR"/Contents/TXM/plugins/CQP.macosx*/res/macosx/* |
85 |
|
86 |
chmod -R +r "$TXMINSTALLDIR" |
87 |
chmod +rx "$TXMINSTALLDIR/Contents/MacOS/TXM" |
88 |
chmod -R +rx /opt/local/lib |
89 |
|
90 |
echo "sudo chown -R $USER $TXMINSTALLDIR" |
91 |
sudo chown -R "$USER" "$TXMINSTALLDIR" |
92 |
|
93 |
if [ $? != 0 ];then |
94 |
echo "** TXM postinstall: failed to set permissions." |
95 |
exit 1 |
96 |
fi |
97 |
|
98 |
#check created directories |
99 |
if [ ! -d "/opt/local/lib" ]; then |
100 |
echo "** TXM postinstall: failed to create /opt/local/lib directory. User has not enough rights?" |
101 |
exit 1 |
102 |
fi |
103 |
|
104 |
say $SAY_DONE |
105 |
echo "** TXM postinstall: Done" |