-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.sh
executable file
·91 lines (72 loc) · 1.91 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
#!/bin/bash
BASE_DIR=$(dirname "$(realpath "$0")")
source "$BASE_DIR/lib/functions.sh"
# COLORS
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
main() {
# Display Bootstrap Elasticsearch banner
display_banner
# Check OS
while :
do
echo -e "Select your Operating System:\n 1. Linux\n 2. Darwin (macOS)\n 3. Auto-detect\n 4. Quit\r\n"
read -p "[Auto-detect]: " ostype
case $ostype in
1)
echo -e "${GREEN}Linux${NC}\r\n"
osname="Linux"
break
;;
2)
echo -e "${GREEN}macOS${NC}\r\n"
osname="Darwin"
break
;;
3)
check_os
break
;;
"")
check_os
break
;;
4)
exit 0
;;
*)
echo -e "${RED}Incorrect input, try again.${NC}\r\n"
esac
done
# Check Elasticsearch version
check_version "Elasticsearch"
# Check installation directory
check_install_dir
# Kibana alongside Elasticsearch
check_kb_standalone
# Download Elasticsearch in the given directory
download "Elasticsearch"
# Download Kibana if requested
if [[ $installkb = true ]]; then
download "Kibana"
fi
parallel_download # To speed up things
# Extract Elasticsearch
extract "Elasticsearch"
# Extract Kibana if previously downloaded
if [[ $installkb = true ]]; then
extract "Kibana"
fi
# Check delete Elasticsearch tarball
check_delete "Elasticsearch"
# Check delete Kibana tarball
if [[ $installkb = true ]]; then
check_delete "Kibana"
fi
# Start Elasticsearch / Kibana
check_start
echo -e "${YELLOW}Congratulations! You're done!${NC}"
}
main "$@"