-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·101 lines (84 loc) · 2.88 KB
/
install.sh
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
#!/bin/bash
## ########################################################################## ##
## Project: La Vie Est Un Jeu - Internal Portal ##
## Description: Installation script ##
## Author: db0 ([email protected], http://db0.fr/) ##
## Latest Version is on GitHub: http://goo.gl/nq7mj ##
## ########################################################################## ##
port=80
conf='portal.conf'
function edit_conf_file() {
file=$1
port=$2
pwd=`pwd | sed 's#\/#\\\/#g'`
cp $file.template $file && \
sed -i".tmp" 's/\$PORT/'$port'/' $file && \
sed -i".tmp" 's/\$PWD/'$pwd'/' $file && \
echo -n "Your GitHub login? " && \
read githublogin && \
sed -i".tmp" 's/\$GITHUBLOGIN/'$githublogin'/' $file
echo -n "Your GitHub password? " && \
read githubpassword && \
sed -i".tmp" 's/\$GITHUBPASSWORD/'$githubpassword'/' $file
rm *.tmp && \
return 0
return 1
}
function delete_files() {
echo "Cleaning..."
rm -vf $conf
rm -vf "tools.eliom" "tools.eliomi"
rm -vf "gCal.eliom" "gCal.eliomi"
rm -vf "github.ml" "github.mli"
rm -rf "bootstrap"
echo "Done."
}
function install_modules() {
delete_files
wget "https://raw.github.com/db0company/OcsiTools/master/tools.eliom" && \
wget "https://raw.github.com/db0company/OcsiTools/master/tools.eliomi" && \
wget "https://raw.github.com/db0company/GCal/master/gCal.eliom" && \
wget "https://raw.github.com/db0company/GCal/master/gCal.eliomi" && \
wget "https://raw.github.com/db0company/GitHub-API-OCaml/master/github.ml" && \
wget "https://raw.github.com/db0company/GitHub-API-OCaml/master/github.mli" && \
wget "http://twitter.github.com/bootstrap/assets/bootstrap.zip" && \
unzip "bootstrap.zip" && \
rm "bootstrap.zip" && \
echo "Done." && \
return 0
return 1
}
function install_modules_links() {
delete_files
defaultpath=..
echo -n "Depositories path ("$defaultpath")? " && \
read path && \
if [ -z $path ]
then path=$defaultpath
fi && \
# get the absolute path if the path is relative
cd $path && path=`pwd` && cd - > /dev/null && \
ln -s $path"/OcsiTools/tools.eliom" && \
ln -s $path"/OcsiTools/tools.eliomi" && \
ln -s $path"/GCal/gCal.eliom" && \
ln -s $path"/GCal/gCal.eliomi" && \
ln -s $path"/GitHub-API-OCaml/github.ml" && \
ln -s $path"/GitHub-API-OCaml/github.mli" && \
ln -s $path"/bootstrap" && \
return 0
return 1
}
if [ $1 = "-clean" ]
then
delete_files
exit 0
fi
echo "Install Modules... " && \
if [ $1 = "-link" ]
then install_modules_links
else install_modules
fi && \
echo "Done." && \
echo -n "Edit configuration file... " && \
edit_conf_file $conf $port && \
echo "Done."