-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·94 lines (80 loc) · 1.82 KB
/
bootstrap.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
#!/bin/bash
BANNER_H="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
BANNER_S="\n\n\n\n\n\n"
GITUSER=$USER
function log()
{
echo $BANNER_H
echo $1
echo -e $BANNER_S
}
function myhelp ()
{
echo "Usage: $0 <CMD>"
echo "-----"
echo " CMD := compile-app | run-app | all |"
echo " env-dep"
}
function prepareEnv()
{
log "PREPARING ENVIRONMENT"
if [ ! -d /var/log/5gcatalogue/ ]; then
sudo mkdir /var/log/5gcatalogue/
sudo chmod a+rw /var/log/5gcatalogue/
fi
which psql
if [ "$?" -gt "0" ]; then
log "POSTGRES not installed... Installing"
sudo apt-get install postgresql -y
fi
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'postgres';"
sudo -u postgres createdb cataloguedb
log "BUILDING NFV-LIB DEPENDENCIES..."
if [ ! -d ../nfv-sol-libs/ ]; then
cd ..
git clone https://github.com/nextworks-it/nfv-sol-libs.git
cd nfv-sol-libs
git checkout v3.1.1
cd ../5g-catalogue
fi
cd ../nfv-sol-libs/NFV_MANO_SOL001_LIBS_COMMON
mvn clean install
cd ../NFV_MANO_SOL001_LIBS_DESCRIPTORS
mvn clean install
cd ../../5g-catalogue
log "CLONING SUBMODULES..."
git submodule update --init
}
function compileApp()
{
log "COMPILING 5G APPs & SERVICEs CATALOGUE"
mvn clean install
}
function runApp()
{
log "RUNNING 5G APPs & SERVICEs CATALOGUE"
cd 5gcatalogue-app
mvn spring-boot:run
cd ../
}
case $1 in
(env-dep)
prepareEnv
;;
(compile-app)
compileApp
;;
(run-app)
runApp
;;
(all)
prepareEnv;
compileApp;
runApp;
;;
(*)
echo "Invalid option '$1'!!!!"
myhelp;
exit -1
;;
esac