summaryrefslogtreecommitdiff
path: root/support/shlatex/en/install
blob: dfb41032f9aafc87c43c4f9b9b3d1a9b39ee011e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# Installation script for ShLaTeX
# Warning : you must be root to run this script !
# This script must be run in the ShLaTeX directory.

# variables d'installation
user=`whoami`;
version="1.2b-en";

# fichiers d'installation
gpl="../GPL.TXT";
src="../src";
tex8to7="../src/tex8to7.c";
man="./man/shlatex.1.bz2";
shlatex="./ShLaTeX";
todo="../TODO.TXT";
fichInstall="$gpl $tex8to7 $man $shlatex $todo";

# répertoires d'installation
cheminMan="/usr/share/man/man1";
cheminExec="/usr/bin";
cheminScript="/usr/share";
repInstall="$cheminMan $cheminExec $cheminScript";

# vérification de l'identité de l'appelant
if [ ! $user == "root" ]
then
	echo -ne "> Error : you must be 'root' to run this script\n";
	echo -ne "    See the README.TXT file for further details.\n";
	exit 1;
fi

# vérification de l'abscence de cette version n'est pas déjà installée
if [ -d "$cheminScript/shlatex-$version" ]
then
	echo "ShLaTeX $version is already installed on your system."
	echo "Before re-installing, you have to uninstall."
	exit 2;
fi

# vérification de l'existence des répertoires cibles, création le cas échéant
for rep in $repInstall
do
	if [ ! -d "$rep" ]
	then
		echo -ne "> Avertissement : impossible de trouver \"$rep\", création du répertoire...\n";
		mkdir -p "$rep"
	fi
done

# vérification de l'existence des fichiers d'installation
for fich in $fichiersInstall
do
	if [ ! -f "$fich" ]
	then
		echo -ne "> Erreur : impossible de trouver le fichier \"$fich\", ce fichier est nécessaire pour l'installation !\n";
		exit 3;
	fi
done

cat $gpl | more

echo -ne "\n\n"

rpse="-";
until [ "$rpse" == "y" -o "$rpse" == "n" ]
do
	read -p "Do you agree the terms of the GNU GPL licence (y/n) ? " rpse
done

if [ ! "$rpse" == "y" ]
then
	echo "> Installation cancelled."
	exit 1;
fi

clear

echo -ne "> Installation in progress...\n"
echo -ne "> Compiling...\n"
gcc $tex8to7 -o tex8to7
echo -ne "> Installation of tex8to7...\n"
cp ./tex8to7 "$cheminExec/tex8to7"
rm -f tex8to7
chmod 755 "$cheminExec/tex8to7"
echo -ne "> Installation of the man page...\n"
cp $man "$cheminMan/shlatex.1.bz2"
chmod 644 "$cheminMan/shlatex.1.bz2"
echo -ne "> Installation of the script...\n"
mkdir "$cheminScript/shlatex-$version"
cp -fR * $gpl $src $todo "$cheminScript/shlatex-$version"
chmod -R 755 "$cheminScript/shlatex-$version"
if [ ! -L "$cheminExec/ShLaTeX" ]
then
	ln -s "$cheminScript/shlatex-$version/ShLaTeX" "$cheminExec/ShLaTeX"
fi
ln -s "$cheminScript/shlatex-$version/ShLaTeX" "$cheminExec/ShLaTeX-$version"
echo -ne "> Test in progress...\n"
cd "$cheminScript/shlatex-$version/test"
chmod 755 ./test
./test
echo -ne "> Done.\n\n"