-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL.sh
executable file
·130 lines (97 loc) · 2.66 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
#! /bin/bash
# Author: Muhammad Khubaib Umer
# Dated: 27-June-2020
# Description: Install Script for Project THOR
if [ $UID -eq 0 ]
then
printf "Please Do Not Run Installer as ROOT\n"
exit 1
fi
USR=$USER
printf "||=============================================================||\n"
printf "|| Welcome to Project THOR ||\n"
printf "||=============================================================||\n"
printf "This Script will help you install Project THOR . . .\n\n"
printf "Project THOR Depends on the following Packages\n"
printf " - libssl-dev\n"
#printf " - libcrypto++-dev\n"
printf " - libsqlite3-dev\n\n"
# Assuming that we need to install these dependencies lets dowload and install them
if ! sudo apt install libssl-dev libsqlite3-dev --install-recommends --upgrade
then
printf "\nPlease Correct the Issues mentioned above and Retry\n"
exit 1
fi
printf "\n\nPlease Enter Installation Directory: "
read -r DIR
printf "\n\nProject THOR will be installed to $DIR \n"
CFG=$DIR/thor.cfg
sudo mkdir -p "$DIR"
sudo touch "$CFG"
sudo chown "$USR" "$DIR" -R
printf "\n\nGenerating Configuration File . . .\n"
printf "Enter IP Address to Bind Server: "
read -r IP
printf "Enter PORT to Bind Server: "
read -r PORT
printf "Do you want to Create a new Certificate file? [y/n]: "
read -r NC
if [ "$NC" = "y" ]
then
printf "Enter Certificate File Name: "
read -r CERT
CERTP=$DIR/$CERT
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $CERTP -out $CERTP
else
printf "Enter Existing Certificate File Path: "
read -r CERTP
fi
printf "Enter Logfile Name: "
read -r LOGFILE
printf "Do you Want to Encrypt Logfile? [y/n]: "
read -r ENC
printf "Enter DataBase Name: "
read -r DB
printf "Enter Applicable Tax: "
read -r TAX
printf "\n\nConfiguration File is being Generated\n"
sleep 2
echo "IP=$IP" > "$CFG"
echo "PORT=$PORT" >> "$CFG"
echo "CERT=$CERTP" >> "$CFG"
echo "LOG=$DIR/$LOGFILE" >> "$CFG"
echo "DB=$DIR/$DB" >> "$CFG"
echo "TAX=$TAX" >> "$CFG"
if [ "$ENC" = "y" ]
then
echo "SEC=1" >> "$CFG"
else
echo "SEC=0" >> "$CFG"
fi
printf "\n\n## EOF\n" >> "$CFG"
printf "\n\nConfiguration File Generated Successfuly with parameters\n\n"
cat "$CFG"
printf "\n\nInstalling Server to Path Specified . . . \n\n"
if ! cp Debug/THOR $DIR 2> /dev/null
then
cp THOR "$DIR"
fi
sudo chown "$USR" "$DIR" -R
sudo chmod a+x "$DIR/THOR"
printf "\n\nInstallation Done! . . . \n\n"
#if [ "$ENC" = "y" ]
#then
#
# printf "\n\nPlease Enter Username and Password to Secure DataBase\n"
# printf "Username: "
# read -s UsrName
# echo ""
#
# printf "Password: "
# read -s UsrPass
# echo ""
#
# printf "ID=$UsrName\n"
# printf "Pass=$UsrPass\n"
#
#fi