forked from conceptsandtraining/doil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·160 lines (140 loc) · 3.17 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
# doil is a tool that creates and manages multiple docker container
# with ILIAS and comes with several tools to help manage everything.
# It is able to download ILIAS and other ILIAS related software
# like cate.
#
# Copyright (C) 2020 - 2021 Laura Herzog ([email protected])
# Permission to copy and modify is granted under the AGPL license
#
# Contribute: https://github.com/conceptsandtraining/doil
#
# /ᐠ。‸。ᐟ\
# Thanks to Concepts and Training for supporting doil
# get the helper
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/src/lib/include/checks.sh
source ${SCRIPT_DIR}/log.sh
source ${SCRIPT_DIR}/system.sh
# check requirements
doil_status_send_message "Checking requirements"
# sudo user check
doil_check_sudo
CHECK_SUDO=$?
if [[ ${CHECK_SUDO} -ne 0 ]]
then
doil_status_failed
doil_status_send_error "REQUIREMENT ERROR" "Please execute this script as sudo user!"
exit
fi
# host check
doil_check_host
CHECK_HOST=$?
if [[ ${CHECK_HOST} -ne 0 ]]
then
doil_status_failed
doil_status_send_error "REQUIREMENT ERROR" "Your operating system is not supported!"
exit
fi
# docker version check
doil_check_docker_version
CHECK_DOCKER=$?
if [[ ${CHECK_DOCKER} -ne 0 ]]
then
doil_status_failed
doil_status_send_error "REQUIREMENT ERROR" "Your docker version is not supported!"
exit
fi
# status for check requirements
doil_status_okay
doil_status_send_message "Creating log file"
doil_system_setup_log
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Adding group"
doil_system_add_group
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Creating mandatory folder"
doil_system_create_folder
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Copy doil system"
doil_system_copy_doil
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Setting up basic configuration"
doil_system_setup_config
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Setting up IP"
doil_system_setup_ip
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Setting up access rights"
doil_system_setup_access
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
doil_status_send_message "Configuring user specific data"
doil_system_setup_userconfig
CHECK=$?
if [[ ${CHECK} -ne 0 ]]
then
doil_status_failed
exit
fi
doil_status_okay
if [[ -z ${GHRUN} ]]
then
# start salt server
doil_status_send_message "Installing salt server"
doil_system_install_saltserver
doil_status_okay
# start proxy server
doil_status_send_message "Installing proxy server"
doil_system_install_proxyserver
doil_status_okay
# start mail server
doil_status_send_message "Installing mail server"
doil_system_install_mailserver
doil_status_okay
fi
#################
# Everything done
NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Everything done"