This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prerequisite
executable file
·146 lines (121 loc) · 3.58 KB
/
prerequisite
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
144
145
146
#!/bin/bash
##--------------------------------------------------------------------
## Copyright (c) 2018 Dianomic Systems
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##--------------------------------------------------------------------
##
## Author: Ashish Jabble
##
set -e
GIT_ROOT=`pwd`
USAGE="./$(basename "$0") [no-dep|no-clone|clean]
This script is used to clone FogLAMP, FogLAMP South Plugin and FogLAMP-gui, install dependencies and build artifacts, required for quickstart debian package creation
Arguments:
no-dep - Skip linux dependencies (i.e. done via apt or apt-get) installation
no-clone - Skip to clone the git repositories & no linux dependencies will be installed (superset of --no-dep)
clean - Remove all the clone git repositories
"
install_deps () {
yes Y | sudo apt-get update
yes Y | sudo apt-get upgrade
yes Y | sudo apt-get install curl
yes Y | sudo apt-get install cmake g++ make build-essential autoconf automake
yes Y | sudo apt-get install libtool libboost-dev libboost-system-dev libboost-thread-dev libpq-dev libssl-dev
yes Y | sudo apt-get install python-setuptools python3-dbus python3-dev python3-pip
yes Y | sudo apt-get install uuid-dev
yes Y | sudo apt-get install sqlite3 libsqlite3-dev
yes Y | sudo apt-get install nginx-light
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
yes Y | sudo apt-get install -y nodejs
yes Y | sudo npm install -g yarn
}
remove_repos () {
rm -rf ${GIT_ROOT}/FogLAMP
rm -rf ${GIT_ROOT}/foglamp-gui
rm -rf ${GIT_ROOT}/foglamp-south-sinusoid
}
clone_repos () {
git clone -b develop --single-branch https://github.com/foglamp/FogLAMP.git
git clone -b develop --single-branch https://github.com/foglamp/foglamp-gui.git
git clone https://github.com/foglamp/foglamp-south-sinusoid.git
}
install_foglamp () {
cd ${GIT_ROOT}/FogLAMP
sudo make install
cd ..
}
build_gui () {
cd ${GIT_ROOT}/foglamp-gui
rm -rf dist
./build --clean-start
cd ..
}
##########################################
# Execute the command specified in $OPTION
##########################################
execute_command() {
if [[ "$OPTION" == "NO_DEP" ]]
then
echo "Skipping dependencies installation"
clone_repos
install_foglamp
build_gui
elif [[ "$OPTION" == "NO_DEP_NO_GIT_CLONE" ]]
then
echo "Skipping dependencies installation and git clone"
install_foglamp
build_gui
elif [[ "$OPTION" == "CLEAN" ]]
then
echo "Removing cloned repo"
remove_repos
elif [[ "$OPTION" == "SHOW_HELP" ]]
then
echo "${USAGE}"
fi
}
start () {
install_deps
remove_repos # if re-executed
clone_repos
install_foglamp
build_gui
}
if [ $# -gt 0 ]
then
for i in "$@"
do
case $i in
--no-dep)
OPTION="NO_DEP"
;;
--no-clone)
OPTION="NO_DEP_NO_GIT_CLONE"
;;
--clean)
OPTION="CLEAN"
;;
-h|--help)
OPTION="SHOW_HELP"
;;
*)
echo "Unrecognized option: $i"
exit 1
;;
esac
execute_command
done
else
start
fi