forked from ontologyportal/sigmakee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·143 lines (128 loc) · 4.07 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash -e
[ -z "$SIGMA_HOME" ] && export SIGMA_HOME="`cd ~ && pwd`/.sigmakee"
SIGMA_SRC="`cd ~ && pwd`/workspace/sigma"
log() {
case $1 in
info) echo && echo "$(tput setaf 2)* ${2}$(tput sgr0)" ;;
warn) echo "$(tput setaf 3) (!) ${2}$(tput sgr0)" ;;
fail) echo && echo "$(tput setaf 1)ERROR: ${2}$(tput sgr0)"; exit 1 ;;
*) echo " $1" ;;
esac
}
welcome() {
log "Welcom to the installation of:"
log ' _________.___ ________ _____ _____'
log ' / _____/| |/ _____/ / \ / _ \'
log ' \_____ \ | / \ ___ / \ / \ / /_\ \'
log ' / \| \ \_\ \/ V \/ | \'
log '/_______ /|___|\______ /\____|__ /\____|__ /'
log ' \/ \/ \/ \/'
log "Home: http://ontologyportal.github.io/sigmakee/"
}
check_supported_os() {
if [ "$(uname)" == "Darwin" ]; then
PLATFORM="mac"
elif [ -n "$(lsb_release -d | grep -i ubuntu)" ]; then
PLATFORM="ubuntu"
else
log fail "Your operating system is not supported. Only Ubuntu and Mac OSX are supported."
fi
}
check_env()
{
# java cvs maven ant
case $PLATFORM in
mac)
if [ -z "$JDK_HOME" ]; then
if hash /usr/libexec/java_home 2>/dev/null; then
JDK_HOME="$(/usr/libexec/java_home)"
fi
if [ -z "$JDK_HOME" ]; then
log fail "No JDK found, please install Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html"
fi
fi
log info "Using existing java installation from: $JDK_HOME"
if ! hash cvs 2>/dev/null; then
brew install cvs
fi
if ! hash ant 2>/dev/null; then
brew install ant
fi
if ! hash mvn 2>/dev/null; then
brew install maven
fi
if ! hash e_ltb_runner2>/dev/null; then
brew install eprover
fi
;;
ubuntu)
log warn "Ubuntu is going to ask your user's password for missed packages check."
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get -y install oracle-java8-installer
sudo apt-get -y install oracle-java8-set-default
sudo apt-get -y install graphviz
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cvs ant maven
wget http://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.8/E.tgz
tar -xzf E.tgz
cd E
./configure
make
;;
esac
}
change_src_home() {
log warn "Please provide the full path (without '~') where you want to put sources of SIGMA"
read -p " To use default \"$SIGMA_SRC\" just press [ENTER]: " src_home
[ -z "$src_home" ] || SIGMA_SRC=$src_home
}
download_src() {
log info "Installing SIGMA to: $SIGMA_SRC"
mkdir -p $SIGMA_SRC
cd $SIGMA_SRC
read -p " Provide your SourceForge account name [anonymous]: " ss_user
if [ -z "$ss_user" ]; then
ss_user=":pserver:anonymous"
else
log warn "To access the code CVS is going to ask your SourceForge password (3 times)."
ss_user=":ext:${ss_user}"
fi
git clone https://github.com/ontologyportal/sigmakee
}
sigma_install() {
log info "Setting SIGMA_HOME to: $SIGMA_HOME"
cd "${SIGMA_SRC}/sigma"
ant install
cp ${SIGMA_SRC}/sigma/config_vagrant.xml $SIGMA_HOME/KBs/config.xml
perl -pi -e 's|/home/vagrant/\.sigmakee|$ENV{SIGMA_HOME}|g' $SIGMA_HOME/KBs/config.xml
perl -pi -e 's|/home/vagrant/workspace/sigma|$ENV{SIGMA_SRC}|g' $SIGMA_HOME/KBs/config.xml
}
sigma_done() {
log info "SIGMA is ready to use"
log warn "To run SIGMA in the future you must use following commands:"
log warn " » export SIGMA_HOME=${SIGMA_HOME}"
log warn " » cd ${SIGMA_SRC}/sigma"
log warn " » mvn -f pom-old.xml -DskipTests clean install tomcat7:run"
echo
log warn "After it started you can open: http://localhost:9090/sigma/login.html"
log warn "Default credentials are: admin/admin"
}
sigma_start() {
stty sane
read -p " Do you want me to run SIGMA for you this time? [Y/n]: " sigma_run
if [ "$sigma_run" == "y" ]; then
#if [[ -z "$sigma_run" || "$sigma_run" =~ [yY] ]]; then
cd ${SIGMA_SRC}/sigma
export SIGMA_HOME=${SIGMA_HOME}
export MAVEN_OPTS="-Xmx1024m"
mvn -f pom-old.xml -DskipTests clean install tomcat7:run
fi
}
welcome
check_supported_os
check_env
change_src_home
download_src
sigma_install
sigma_done
sigma_start