-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.sh
74 lines (52 loc) · 2.26 KB
/
prepare.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
#!/bin/bash
set eux;
WORKDIR=$(pwd)
echo "-------------------------------------------------------";
echo "Installing Dependencies";
echo "-------------------------------------------------------";
# Update mirrors
apt-get update;
# Install dependencies
apt install golang ca-certificates curl gnupg lsb-release -y;
# Download docker repository key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg;
# Add docker repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null;
# Update mirrors
apt-get update;
# Install docker for postgres
apt-get install docker-ce docker-ce-cli containerd.io -y;
if systemctl is-active --quiet postgresql.service; then
systemctl disable --now postgresql;
fi
# Start database container
docker run --name postgres -e POSTGRES_PASSWORD=fim -e POSTGRES_USER=fim -p 5432:5432 -d postgres;
echo "-------------------------------------------------------";
echo "Compiling Server";
echo "-------------------------------------------------------";
cd "${WORKDIR}/fimserver" && go build;
chmod 0777 fimserver;
echo "-------------------------------------------------------";
echo "Compiling Client";
echo "-------------------------------------------------------";
cd "${WORKDIR}/fimclient" && go build;
chmod 0777 fimclient;
echo "-------------------------------------------------------";
echo "Compiling Agent";
echo "-------------------------------------------------------";
cd "${WORKDIR}/fimagent" && go build;
chmod 0700 fimagent;
echo "-------------------------------------------------------";
echo "Compiling Ransomware";
echo "-------------------------------------------------------";
cd "${WORKDIR}/ransomware" && go build;
chmod 0777 ransomware;
echo "-------------------------------------------------------";
echo "Preparing Database";
echo "-------------------------------------------------------";
cd "${WORKDIR}/fimserver" && ./fimserver --setup;
echo "-------------------------------------------------------";
echo "Preparation finished";
echo "-------------------------------------------------------";