/
AegirSetupA.sh.txt
230 lines (204 loc) · 5.6 KB
/
AegirSetupA.sh.txt
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#!/bin/bash
###----------------------------------------###
###
### Octopus Aegir Installer
###
### Copyright (C) 2010-2023 Omega8.cc
### noc@omega8.cc www.omega8.cc
###
### This program is free software. You can
### redistribute it and/or modify it under
### the terms of the GNU GPL as published by
### the Free Software Foundation, version 2
### or later.
###
### This program is distributed in the hope
### that it will be useful, but WITHOUT ANY
### WARRANTY; without even the implied
### warranty of MERCHANTABILITY or FITNESS
### FOR A PARTICULAR PURPOSE. See the GNU GPL
### for more details.
###
### You should have received a copy of the
### GNU GPL along with this program.
### If not, see http://www.gnu.org/licenses/
###
### Code: https://github.com/omega8cc/boa
###
###----------------------------------------###
###----------------------------------------###
### DON'T EDIT ANYTHING BELOW THIS LINE ###
###----------------------------------------###
###
### Helper variables
###
bldPth="/opt/tmp/boa"
crlGet="-L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab"
filIncO="octopus.sh.cnf"
gCb="git clone --branch"
gitHub="https://github.com/omega8cc"
gitLab="https://gitlab.com/omega8cc"
libFnc="${bldPth}/lib/functions"
tocIncO="${filIncO}.$1"
vBs="/var/backups"
vSet="variable-set --always-set"
###
### Panic on missing include
###
panic_exit() {
echo
echo " EXIT: Required lib file not available?"
echo " EXIT: $1"
echo " EXIT: Cannot continue"
echo " EXIT: Bye (0)"
echo
touch /opt/tmp/status-AegirSetupA-FAIL
exit 1
}
###
### Include helper functions
###
if [ -e "${vBs}/${tocIncO}" ]; then
source "${vBs}/${tocIncO}"
tInc="${vBs}/${tocIncO}"
elif [ -e "${vBs}/${filIncO}" ]; then
source "${vBs}/${filIncO}"
tInc="${vBs}/${filIncO}"
else
panic_exit "${tInc}"
fi
###
### Env debugging
###
if [ "${_DEBUG_MODE}" = "YES" ]; then
echo DEBUG AegirSetupA
echo DEBUG AegirSetupA
echo Effective _USER is $1
[ -r "${vBs}/${tocIncO}" ] && echo Effective tocIncO is ${tocIncO}
echo DEBUG AegirSetupA
echo DEBUG AegirSetupA
env
echo DEBUG AegirSetupA
echo DEBUG AegirSetupA
fi
###
### More helper variables
###
urlDev="http://${_USE_MIR}/dev"
urlHmr="http://${_USE_MIR}/versions/master/aegir"
###
### Include shared functions
###
_FL="helper satellite"
for f in ${_FL}; do
[ -r "${libFnc}/${f}.sh.inc" ] || panic_exit "${f}"
source "${libFnc}/${f}.sh.inc"
done
###
### Local variables
###
if [ "${_THIS_DB_HOST}" = "FQDN" ]; then
_THIS_DB_HOST=$(uname -n 2>&1)
fi
_DIST_INSTALL=NO
_STATUS=INIT
_LOCAL_STATUS="${_STATUS}"
_ROOT="/data/disk/${_USER}"
_HM_ROOT="${_ROOT}/aegir/distro/${_HM_DISTRO}"
_DISTRO_ROOT="${_ROOT}/distro/${_DISTRO}"
_D="/data/all"
_SRCDIR="/opt/tmp/files"
_LOG="/var/backups/octopus-${_USER}-${_NOW}.log"
if [ "${_PHP_CLI_VERSION}" = "8.2" ] \
&& [ -x "/opt/php82/bin/php" ]; then
_T_CLI=/opt/php82/bin
elif [ "${_PHP_CLI_VERSION}" = "8.1" ] \
&& [ -x "/opt/php81/bin/php" ]; then
_T_CLI=/opt/php81/bin
elif [ "${_PHP_CLI_VERSION}" = "8.0" ] \
&& [ -x "/opt/php80/bin/php" ]; then
_T_CLI=/opt/php80/bin
elif [ "${_PHP_CLI_VERSION}" = "7.4" ] \
&& [ -x "/opt/php74/bin/php" ]; then
_T_CLI=/opt/php74/bin
elif [ "${_PHP_CLI_VERSION}" = "7.3" ] \
&& [ -x "/opt/php73/bin/php" ]; then
_T_CLI=/opt/php73/bin
elif [ "${_PHP_CLI_VERSION}" = "7.2" ] \
&& [ -x "/opt/php72/bin/php" ]; then
_T_CLI=/opt/php72/bin
elif [ "${_PHP_CLI_VERSION}" = "7.1" ] \
&& [ -x "/opt/php71/bin/php" ]; then
_T_CLI=/opt/php71/bin
elif [ "${_PHP_CLI_VERSION}" = "7.0" ] \
&& [ -x "/opt/php70/bin/php" ]; then
_T_CLI=/opt/php70/bin
elif [ "${_PHP_CLI_VERSION}" = "5.6" ] \
&& [ -x "/opt/php56/bin/php" ]; then
_T_CLI=/opt/php56/bin
fi
_DRUSHCMD="${_T_CLI}/php ${_ROOT}/tools/drush/drush.php"
PATH=${_T_CLI}:/usr/local/bin:/opt/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
SHELL=/bin/bash
###
### Status check and update on the fly
###
if [ -e "${_ROOT}/aegir.sh" ]; then
_STATUS=UPGRADE
cd ${_ROOT}
rm -f ${_ROOT}/AegirSetupC.sh.txt*
rm -f ${_ROOT}/AegirSetupB.sh.txt*
_LOCAL_STATUS="${_STATUS}"
if [ -e "/var/run/aegir_upgrade.pid" ]; then
_LOCAL_STATUS=INIT
fi
fi
###
### User check
###
if [ `whoami` = "root" ]; then
if [ "${_DEBUG_MODE}" = "YES" ]; then
msg "${_STATUS} A: Aegir automated install script part A"
fi
else
msg "${_STATUS} A: FATAL ERROR: This script should be ran as a root user"
msg "${_STATUS} A: FATAL ERROR: Aborting AegirSetupA installer NOW!"
touch /opt/tmp/status-AegirSetupA-FAIL
exit 1
fi
###
### Run all pre/child/post procedures
###
satellite_version_check
satellite_hot_sauce_check
satellite_add_user_dirs
satellite_prepare_child_scripts
satellite_run_pre_install
satellite_download_for_local_build
satellite_run_child_b
satellite_if_create_local_bin
satellite_run_post_install
satellite_set_permissions_for_all
satellite_run_child_c
satellite_if_legacy_permissions_fix
satellite_child_scripts_cleanup
satellite_if_add_ftps_lshell_access
satellite_if_add_to_rvm_group
satellite_if_add_update_user_symlinks
satellite_if_add_update_user_dot_dirs
satellite_if_read_create_pass_txt
satellite_if_add_update_user_platforms_symlinks
satellite_if_add_update_backend_user_dirs_files_clean
[ ! -e "/root/.silent.update.cnf" ] && satellite_prepare_setup_email_tpl
[ ! -e "/root/.silent.update.cnf" ] && satellite_send_welcome_email
satellite_letsencrypt_vhost_setup
satellite_log_update
satellite_batch_cleanup
satellite_display_url_finalize
###----------------------------------------###
###
### Octopus Aegir Installer
### Copyright (C) 2010-2023 Omega8.cc
### noc@omega8.cc www.omega8.cc
###
###----------------------------------------###