Statistics
| Revision:

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

History | View | Annotate | Download (2.8 kB)

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