-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISPmanager.sh
More file actions
209 lines (187 loc) · 6.08 KB
/
ISPmanager.sh
File metadata and controls
209 lines (187 loc) · 6.08 KB
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
#!/bin/sh
## OS: "alma8","alma9","debian11","debian12","ubuntu2004","ubuntu2204","ubuntu2404","rocky8","lic_ISPmanager_6_Lite"
#
# metadata_begin
# recipe: Ispmanager
# tags: alma8,alma9,debian11,debian12,ubuntu2004,ubuntu2204,ubuntu2404,rocky8,lic_ISPmanager_6_Lite
# revision: 27
# description_ru: Установить ispmanager
# description_en: Install ispmanager
# metadata_end
#
RNAME="Ispmanager"
set -x
umask 0022
LOG_PIPE=/tmp/log.pipe.$$
mkfifo ${LOG_PIPE}
LOG_FILE=/root/ispmgr.log
touch ${LOG_FILE}
chmod 600 ${LOG_FILE}
tee < ${LOG_PIPE} ${LOG_FILE} &
exec > ${LOG_PIPE}
exec 2> ${LOG_PIPE}
killjobs() {
rm -f /usr/local/mgr5/lib/pkgsh/hooks/ispmanager-plugin-revisium.sh
rm -rf /usr/local/mgr5/etc/ihttpd_errpage
jops="$(jobs -p)"
test -n "${jops}" && kill ${jops} || :
}
trap killjobs INT TERM EXIT
echo
echo "=== Recipe ${RNAME} started at $(date) ==="
echo
HOME=/root
export HOME
if [ -f /etc/redhat-release ]; then
OSNAME=centos
else
OSNAME=debian
fi
set -x
mkdir -p /usr/local/mgr5/etc/ihttpd_errpage
cat > /usr/local/mgr5/etc/ihttpd_errpage/manager_ispmgr.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>Panel is installing, please wait...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
* {
margin: 0;
padding: 0;
border: 0 none;
background: none;
}
body {
font-weight: normal;
font-size: 11px;
font-family: Arial;
}
#login-wrapper {
width: 270px;
left: 50%;
margin-left: -135px;
position: absolute;
margin-top: -164px;
top: 50%;
}
#login-form {
width: 270px;
background: #78a5df;
height: 270px;
-webkit-border-radius: 135px;
-moz-border-radius: 135px;
border-radius: 135px;
}
#login-form-form .loading {
text-align: center;
padding-top: 124px;
color: white;
}
#login-wrapper #links {
margin: 0 auto;
display: table;
margin-top: 75px;
}
ul li {
list-style: none;
}
.body-login-form .tab-content {
position: inherit;
padding: inherit;
}
#login-wrapper #links li {
padding-left: 24px;
line-height: 23px;
}
a {
color: #537393;
}
</style>
<script type="text/javascript">
setTimeout(function() {
window.location.reload();
}, 60000);
</script>
</head>
<body class="body-login-form">
<div id="main-wrapper">
<div id="overlay" class="hide"></div>
<div id="content" class="tab-content active" data-tabid="tab1"><div id="login-wrapper">
<div id="login-form">
<div id="login-form-form">
<h2 class="loading">Ispmanager is installing, please wait...</h2>
</div>
</div>
<div id="links"><ul><li class="copyright"><a href="https://www.ispmanager.ru" target="_blank">Ispmanager © 2024</a></li></ul></div>
<div id="error-log" style="display: none;"></div>
</div></div>
</div>
</body>
</html>
EOF
mkdir -p /usr/local/mgr5/lib/pkgsh/hooks
cat > /usr/local/mgr5/lib/pkgsh/hooks/ispmanager-plugin-revisium.sh << EOF
echo "Locked"
exit 1
EOF
if [ "#${OSNAME}" = "#debian" ]; then
if [ -f /etc/init.d/bind9 ] && ! dpkg -S /etc/init.d/bind9 ; then
rm -f /etc/init.d/bind9
fi
apt-get update --allow-releaseinfo-change || :
apt-mark hold qemu-guest-agent || :
fi
if [ "#${OSNAME}" = "#centos" ]; then
# shellcheck disable=SC2154
if [ ! "($HTTPPROXYv4)" = "()" ]; then
# Стрипаем пробелы, если они есть
PR="($HTTPPROXYv4)"
PR=$(echo ${PR} | sed "s/''//g" | sed 's/""//g')
if [ -n "${PR}" ]; then
echo "proxy=${PR}" >> /etc/yum.conf
# export http_proxy="${PR}"
# export HTTP_PROXY="${PR}"
fi
fi
# sed -i"ispbak" -r "s/^(mirrorlist=)/#\1/g; s/^#(baseurl=)/\1/g" /etc/yum.repos.d/*.repo
yum install -y curl ca-certificates yum-plugin-versionlock
yum versionlock qemu-guest-agent
echo "Installing ispmanager"
cd /root || exit
selinuxenabled && echo "selinux enabled"
curl -o install.sh "https://download.ispmanager.com/install.sh" || (sleep 1; curl -o install.sh "https://download.ispmanager.com/install.sh") || (sleep 1; curl -o install.sh "https://download.ispmanager.com/install.sh")
sh install.sh --silent --ignore-hostname --release beta --ispmgr6 ispmanager-lite
if [ "#$(rpm -qf /etc/centos-release --qf "%{version}")" = "#7" ]; then
# centos-7
yum -y remove ispmanager-lite ispmanager-pkg-httpd
yum -y install ispmanager-pkg-httpd-itk ispmanager-pkg-php ispmanager-pkg-myadmin ispmanager-pkg-roundcube
fi
yum clean all
sed -i -r "s|^short_open_tag = Off|short_open_tag = On|" /etc/php.ini
_timezone="($TIMEZONE)"
if [ -n "${_timezone}" ] && [ ! "${_timezone}" = "()" ]; then
if ! grep -q "^date.timezone =" /etc/php.ini ; then
sed -i -r "s|;date.timezone =|date.timezone = ${_timezone}|" /etc/php.ini
else
sed -i -r "s|^date.timezone = .+|date.timezone = ${_timezone}|" /etc/php.ini
fi
fi
/usr/local/mgr5/sbin/mgrctl -m ispmgr -R feature.update sok=ok
# for file in /etc/yum.repos.d/*.repoispbak; do mv -f $file $(echo $file|sed 's/ispbak//'); done
sed -r -i "/proxy=/d" /etc/yum.conf
yum versionlock delete qemu-guest-agent
echo "Installation finished at $(date)"
else
sed -i -r '/jessie-updates/d' /etc/apt/sources.list || :
apt update
apt install -y wget ca-certificates
wget -O install.sh "https://download.ispmanager.com/install.sh" || (sleep 1; wget -O install.sh "https://download.ispmanager.com/install.sh") || (sleep 1; wget -O install.sh "https://download.ispmanager.com/install.sh")
# Wait firstrun script
while ps uxaww | grep -v grep | grep -Eq 'apt-get|dpkg' ; do echo "waiting..." ; sleep 3 ; done
sh install.sh --silent --ignore-hostname --release beta --ispmgr6 ispmanager-lite
apt-mark unhold qemu-guest-agent || :
fi
echo "utf-8" >> /usr/local/mgr5/etc/charset
echo "windows-1251" >> /usr/local/mgr5/etc/charset
/usr/local/mgr5/sbin/mgrctl -m ispmgr db.server.edit elid=MySQL sok=ok || exit 1