Merge pull request #620 from midoks/dev

0.17.2
This commit is contained in:
Mr Chen
2024-07-26 23:08:01 +08:00
committed by GitHub
117 changed files with 3019 additions and 575 deletions
+8 -5
View File
@@ -42,7 +42,7 @@ Talk is cheap, show me the code. -- linus
### 主要插件介绍
* OpenResty - 轻量级,占有内存少,并发能力强。
* PHP[53-83] - PHP是世界上最好的编程语言。
* PHP[53-84] - PHP是世界上最好的编程语言。
* MySQL - 一种关系数据库管理系统。
* MariaDB - 是MySQL的一个重要分支。
* MySQL[APT/YUM] - 一种关系数据库管理系统。
@@ -75,10 +75,10 @@ Talk is cheap, show me the code. -- linus
```
phpMyAdmin[4.4.15]支持MySQL[5.5-5.7]
phpMyAdmin[5.2.0]支持MySQL[8.0]
phpMyAdmin[5.2.1]支持MySQL[8.0+]
PHP[53-72]支持phpMyAdmin[4.4.15]
PHP[72-83]支持phpMyAdmin[5.2.0]
PHP[72-84]支持phpMyAdmin[5.2.1]
```
# 郑重声明
@@ -110,9 +110,12 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.17.1
### 版本更新 0.17.2
- 任务管理器-插件。
- MySQL9.0。
- zabbix,zabbix-agent测试。
- 正则匹配修复(兼容)。
- 常规更新。
### JSDelivr安装地址
+9 -10
View File
@@ -377,7 +377,7 @@ fi
return response
except Exception as ex:
# self.getError()
raise Exception("requestsPost: {}".format(self.getError(str(ex))))
raise Exception("异常: {}".format(self.getError(str(ex))))
def getRequestJson(self, response):
try:
@@ -1279,7 +1279,7 @@ fullchain.pem 粘贴到证书输入框
file = self.getHostConf(siteName)
if os.path.exists(file):
conf = mw.readFile(file)
rep = '\s*root\s*(.+);'
rep = r'\s*root\s*(.+);'
path = re.search(rep, conf).groups()[0]
return path
return ''
@@ -1391,7 +1391,8 @@ fullchain.pem 粘贴到证书输入框
raise Exception("指定订单号不存在,无法续签!")
order_index.append(index)
else:
start_time = time.time() + (30 * 86400)
# 测试一天过期
now_time = time.time()
# print(self.__config)
if not 'orders' in self.__config:
self.__config['orders'] = {}
@@ -1402,16 +1403,14 @@ fullchain.pem 粘贴到证书输入框
continue
if 'cert' in self.__config['orders'][i]:
self.__config['orders'][i]['cert_timeout'] = self.__config[
'orders'][i]['cert']['cert_timeout']
self.__config['orders'][i]['cert_timeout'] = self.__config['orders'][i]['cert']['cert_timeout']
if not 'cert_timeout' in self.__config['orders'][i]:
self.__config['orders'][i][
'cert_timeout'] = int(time.time())
self.__config['orders'][i]['cert_timeout'] = int(time.time())
if self.__config['orders'][i]['cert_timeout'] > start_time:
msg = "|-本次跳过域名: {},未过期!".format(
self.__config['orders'][i]['domains'][0])
# print(self.__config['orders'][i]['domains'][0], (self.__config['orders'][i]['cert_timeout'] - now_time)/86400, now_time)
if self.__config['orders'][i]['cert_timeout'] - now_time > 83*86400:
msg = "|-本次跳过域名: {},未过期!".format(self.__config['orders'][i]['domains'][0])
writeLog(msg)
continue
+1 -1
View File
@@ -28,7 +28,7 @@ from flask import request
class config_api:
__version = '0.17.1'
__version = '0.17.2'
__api_addr = 'data/api.json'
# 统一默认配置文件
+11 -11
View File
@@ -50,7 +50,7 @@ class firewall_api:
port = request.form.get('port', '').strip()
ps = request.form.get('ps', '').strip()
rep = "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,2})?$"
rep = r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,2})?$"
if not re.search(rep, port):
return mw.returnJson(False, '您输入的IP地址不合法!')
address = port
@@ -97,7 +97,7 @@ class firewall_api:
if not self.getFwStatus():
self.setFw(0)
rep = "^\d{1,5}(:\d{1,5})?$"
rep = r"^\d{1,5}(:\d{1,5})?$"
if not re.search(rep, port):
return mw.returnData(False, '端口范围不正确!')
@@ -217,7 +217,7 @@ class firewall_api:
file = '/etc/ssh/sshd_config'
conf = mw.readFile(file)
rep = "#*Port\s+([0-9]+)\s*\n"
rep = r"#*Port\s+([0-9]+)\s*\n"
port = re.search(rep, conf).groups(0)[0]
isPing = True
@@ -227,7 +227,7 @@ class firewall_api:
else:
file = '/etc/sysctl.conf'
sys_conf = mw.readFile(file)
rep = "#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
rep = r"#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
tmp = re.search(rep, sys_conf).groups(0)[0]
if tmp == '1':
isPing = False
@@ -248,7 +248,7 @@ class firewall_api:
data['pass_prohibit_status'] = False
# 密码登陆配置检查
pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
pass_rep = r"PasswordAuthentication\s+(\w*)\s*\n"
pass_status = re.search(pass_rep, conf)
if pass_status:
if pass_status and pass_status.groups(0)[0].strip() == 'no':
@@ -277,7 +277,7 @@ class firewall_api:
file = '/etc/ssh/sshd_config'
conf = mw.readFile(file)
rep = "#*Port\s+([0-9]+)\s*\n"
rep = r"#*Port\s+([0-9]+)\s*\n"
conf = re.sub(rep, "Port " + port + "\n", conf)
mw.writeFile(file, conf)
@@ -330,17 +330,17 @@ class firewall_api:
conf = mw.readFile(file)
pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
pass_rep = r"PasswordAuthentication\s+(\w*)\s*\n"
pass_status = re.search(pass_rep, conf)
if not pass_status:
rep = "(#)?PasswordAuthentication\s+(\w*)\s*\n"
rep = r"(#)?PasswordAuthentication\s+(\w*)\s*\n"
conf = re.sub(rep, "PasswordAuthentication yes\n", conf)
if status == '1':
rep = "PasswordAuthentication\s+(\w*)\s*\n"
rep = r"PasswordAuthentication\s+(\w*)\s*\n"
conf = re.sub(rep, "PasswordAuthentication yes\n", conf)
else:
rep = "PasswordAuthentication\s+(\w*)\s*\n"
rep = r"PasswordAuthentication\s+(\w*)\s*\n"
conf = re.sub(rep, "PasswordAuthentication no\n", conf)
mw.writeFile(file, conf)
mw.execShell("systemctl restart sshd.service")
@@ -355,7 +355,7 @@ class firewall_api:
filename = '/etc/sysctl.conf'
conf = mw.readFile(filename)
if conf.find('net.ipv4.icmp_echo') != -1:
rep = u"net\.ipv4\.icmp_echo.*"
rep = r"net\.ipv4\.icmp_echo.*"
conf = re.sub(rep, 'net.ipv4.icmp_echo_ignore_all=' + status, conf)
else:
conf += "\nnet.ipv4.icmp_echo_ignore_all=" + status
+1 -1
View File
@@ -480,7 +480,7 @@ class plugins_api:
plugin_path = mw.getPluginDir() + '/' + plugin_name
if not os.path.exists(plugin_path):
print(mw.execShell('mkdir -p ' + plugin_path))
mw.execShell("\cp -rf " + tmp_path + '/* ' + plugin_path + '/')
mw.execShell("cp -rf " + tmp_path + '/* ' + plugin_path + '/')
mw.execShell('chmod -R 755 ' + plugin_path)
p_info = mw.readFile(plugin_path + '/info.json')
if p_info:
+3 -3
View File
@@ -2802,7 +2802,7 @@ location ^~ {from} {\n\
add_header Strict-Transport-Security "max-age=63072000";
add_header Alt-Svc 'h3=":443";ma=86400';
"""
if version != '1.25.3.1':
if not version.startswith('1.25'):
http3Header = '';
sslStr = """#error_page 404/404.html;
@@ -2820,12 +2820,12 @@ location ^~ {from} {\n\
conf = conf.replace('#error_page 404/404.html;', sslStr)
rep = "listen\s+([0-9]+)\s*[default_server]*;"
rep = "listen\s+([0-9]+)\s*[default_server|reuseport]*;"
tmp = re.findall(rep, conf)
if not mw.inArray(tmp, '443'):
listen = re.search(rep, conf).group()
if version == '1.25.3.1':
if version.startswith('1.25'):
http_ssl = "\n\tlisten 443 ssl;"
http_ssl = http_ssl + "\n\tlisten [::]:443 ssl;"
http_ssl = http_ssl + "\n\tlisten 443 quic;"
+6 -6
View File
@@ -170,12 +170,12 @@ def initDreplace():
def getRootUrl():
content = mw.readFile(getConf())
rep = 'ROOT_URL\s*=\s*(.*)'
rep = r'ROOT_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0]
rep = 'EXTERNAL_URL\s*=\s*(.*)'
rep = r'EXTERNAL_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0]
@@ -184,7 +184,7 @@ def getRootUrl():
def getSshPort():
content = mw.readFile(getConf())
rep = 'SSH_PORT\s*=\s*(.*)'
rep = r'SSH_PORT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -193,7 +193,7 @@ def getSshPort():
def getHttpPort():
content = mw.readFile(getConf())
rep = 'HTTP_PORT\s*=\s*(.*)'
rep = r'HTTP_PORT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -202,7 +202,7 @@ def getHttpPort():
def getRootPath():
content = mw.readFile(getConf())
rep = 'ROOT\s*=\s*(.*)'
rep = r'ROOT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -215,7 +215,7 @@ def getDbConfValue():
return {}
content = mw.readFile(conf)
rep_scope = "\[database\](.*?)\["
rep_scope = r"\[database\](.*?)\["
tmp = re.findall(rep_scope, content, re.S)
rep = '(\w*)\s*=\s*(.*)'
+7 -7
View File
@@ -173,12 +173,12 @@ def initDreplace():
def getRootUrl():
content = mw.readFile(getConf())
rep = 'ROOT_URL\s*=\s*(.*)'
rep = r'ROOT_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0]
rep = 'EXTERNAL_URL\s*=\s*(.*)'
rep = r'EXTERNAL_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0]
@@ -187,7 +187,7 @@ def getRootUrl():
def getSshPort():
content = mw.readFile(getConf())
rep = 'SSH_PORT\s*=\s*(.*)'
rep = r'SSH_PORT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -196,7 +196,7 @@ def getSshPort():
def getHttpPort():
content = mw.readFile(getConf())
rep = 'HTTP_PORT\s*=\s*(.*)'
rep = r'HTTP_PORT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -205,7 +205,7 @@ def getHttpPort():
def getRootPath():
content = mw.readFile(getConf())
rep = 'ROOT\s*=\s*(.*)'
rep = r'ROOT\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
@@ -218,10 +218,10 @@ def getDbConfValue():
return {}
content = mw.readFile(conf)
rep_scope = "\[database\](.*?)\["
rep_scope = r"\[database\](.*?)\["
tmp = re.findall(rep_scope, content, re.S)
rep = '(\w*)\s*=\s*(.*)'
rep = r'(\w*)\s*=\s*(.*)'
tmp = re.findall(rep, tmp[0])
r = {}
for x in range(len(tmp)):
+1 -1
View File
@@ -253,7 +253,7 @@ def getPort():
conf = getServerDir() + '/keepalived.conf'
content = mw.readFile(conf)
rep = "^(" + 'port' + ')\s*([.0-9A-Za-z_& ~]+)'
rep = r"^(" + 'port' + r')\s*([.0-9A-Za-z_& ~]+)'
tmp = re.search(rep, content, re.M)
if tmp:
return tmp.groups()[1]
+1 -1
View File
@@ -38,7 +38,7 @@ max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
skip-name-resolve = on
skip-name-resolve = 1
#skip-networking
#skip-external-locking
#loose-skip-innodb
+15 -17
View File
@@ -86,21 +86,21 @@ def getConf():
def getDataDir():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getLogBinName():
file = getConf()
content = mw.readFile(file)
rep = 'log-bin\s*=\s*(.*)'
rep = r'log-bin\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pid-file\s*=\s*(.*)'
rep = r'pid-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -108,7 +108,7 @@ def getPidFile():
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -116,7 +116,7 @@ def getDbPort():
def getDbServerId():
file = getConf()
content = mw.readFile(file)
rep = 'server-id\s*=\s*(.*)'
rep = r'server-id\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -124,7 +124,7 @@ def getDbServerId():
def getSocketFile():
file = getConf()
content = mw.readFile(file)
rep = 'socket\s*=\s*(.*)'
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -378,7 +378,7 @@ def getErrorLog():
def getShowLogFile():
file = getConf()
content = mw.readFile(file)
rep = 'slow-query-log-file\s*=\s*(.*)'
rep = r'slow-query-log-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -547,7 +547,7 @@ def initdUinstall():
def getMyDbPos():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -597,7 +597,7 @@ def setMyDbPos():
def getMyPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -611,7 +611,7 @@ def setMyPort():
port = args['port']
file = getConf()
content = mw.readFile(file)
rep = "port\s*=\s*([0-9]+)\s*\n"
rep = r"port\s*=\s*([0-9]+)\s*\n"
content = re.sub(rep, 'port = ' + port + '\n', content)
mw.writeFile(file, content)
restart()
@@ -688,7 +688,7 @@ def setDbStatus():
s = 'K'
if g in emptys:
s = ''
rep = '\s*' + g + '\s*=\s*\d+(M|K|k|m|G)?\n'
rep = r'\s*' + g + r'\s*=\s*\d+(M|K|k|m|G)?\n'
c = g + ' = ' + args[g] + s + '\n'
if content.find(g) != -1:
content = re.sub(rep, '\n' + c, content, 1)
@@ -1280,7 +1280,7 @@ def addDb():
dataAccess = args['dataAccess'].strip()
ps = args['ps'].strip()
reg = "^[\w\.-]+$"
reg = r"^[\w\.-]+$"
if not re.match(reg, args['name']):
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
@@ -1846,8 +1846,7 @@ def setDbMaster(version):
if not isHas:
prefix = '#binlog-do-db'
con = con.replace(
prefix, prefix + "\nbinlog-do-db=" + args['name'])
con = con.replace(prefix, prefix + "\nbinlog-do-db=" + args['name'])
mw.writeFile(conf, con)
restart(version)
@@ -1876,8 +1875,7 @@ def setDbSlave(version):
if not isHas:
prefix = '#replicate-do-db'
con = con.replace(
prefix, prefix + "\nreplicate-do-db=" + args['name'])
con = con.replace(prefix, prefix + "\nreplicate-do-db=" + args['name'])
mw.writeFile(conf, con)
restart(version)
@@ -1997,7 +1995,7 @@ def addMasterRepSlaveUser(version=''):
# address = args['address'].strip()
# dataAccess = args['dataAccess'].strip()
reg = "^[\w-]+$"
reg = r"^[\w-]+$"
if not re.match(reg, username):
return mw.returnJson(False, '用户名不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
+1 -1
View File
@@ -8,7 +8,7 @@
"uninstall_pre_inspection":true,
"checks": "server/mariadb",
"path": "server/mariadb",
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3"],
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3","11.4"],
"shell":"install.sh",
"checks":"server/mariadb",
"path":"server/mariadb",
+2 -2
View File
@@ -29,12 +29,12 @@ else
fi
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
echo '缺少安装脚本...'
exit 0
fi
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
echo '缺少安装脚本2...'
exit 0
fi
+1 -1
View File
@@ -14,7 +14,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb
MY_VER=10.11.7
MY_VER=10.11.8
Install_app()
{
+1 -1
View File
@@ -13,7 +13,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb
MY_VER=10.6.17
MY_VER=10.6.18
Install_app()
{
+1 -1
View File
@@ -14,7 +14,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb
MY_VER=11.2.3
MY_VER=11.2.4
Install_app()
{
+121
View File
@@ -0,0 +1,121 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
#https://dev.mysql.com/downloads/mysql/5.5.html#downloads
#https://dev.mysql.com/downloads/file/?id=480541
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb
MY_VER=11.4.2
Install_app()
{
mkdir -p ${mariadbDir}
echo '正在安装脚本文件...' > $install_tmp
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
# if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
# wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
# fi
# https://downloads.mariadb.org/interstitial/mariadb-10.9.1/source/mariadb-10.9.1.tar.gz
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://archive.mariadb.org/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
fi
INSTALL_CMD=cmake
# check cmake version
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
if [ "$CMAKE_VERSION" -eq "2" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
INSTALL_CMD=cmake3
fi
if [ ! -d $serverPath/mariadb ];then
cd ${mariadbDir}/mariadb-${MY_VER} && ${INSTALL_CMD} \
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
-DMYSQL_USER=mysql \
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mariadb ];then
echo '11.4' > $serverPath/mariadb/version.pl
echo '安装完成'
else
echo '安装失败'
echo 'install fail'>&2
exit 1
fi
fi
if [ -d ${mariadbDir}/mariadb-${MY_VER} ];then
rm -rf ${mariadbDir}/mariadb-${MY_VER}
fi
}
Uninstall_app()
{
rm -rf $serverPath/mariadb
echo '卸载完成' > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_app
else
Uninstall_app
fi
+1 -1
View File
@@ -59,7 +59,7 @@ def getConfTpl():
def getMemPort():
path = getServerDir() + '/memcached.env'
content = mw.readFile(path)
rep = 'PORT\s*=\s*(\d*)'
rep = r'PORT\s*=\s*(\d*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
+1 -1
View File
@@ -9,7 +9,7 @@ serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
sys_os=`uname`
VERSION=1.6.22
VERSION=1.6.29
echo $sys_os
+103
View File
@@ -0,0 +1,103 @@
[client]
user = root
#password = your_password
port = 33206
socket = {$SERVER_APP_PATH}/mysql.sock
default-character-set = UTF8MB4
[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
authentication_policy=caching_sha2_password
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
user = mysql
port = 33206
mysqlx_port = 33260
socket = {$SERVER_APP_PATH}/mysql.sock
datadir = {$SERVER_APP_PATH}/data
log-error = {$SERVER_APP_PATH}/data/error.log
server-id = {$SERVER_ID}
default_storage_engine = InnoDB
key_buffer_size = 8M
table_open_cache = 32
sort_buffer_size = 256K
net_buffer_length = 4K
read_buffer_size = 128K
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 4M
thread_cache_size = 4
lower_case_table_names=1
tmp_table_size = 8M
character-set-server = UTF8MB4
max_connections = 500
max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M
#skip-external-locking
#skip-grant-tables
#loose-skip-innodb
#skip-networking
#skip-name-resolve
log-bin=mysql-bin
slow_query_log=1
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on
relay-log=mdserver
relay-log-index=mdserver
#master
#sync_binlog=1
#binlog-do-db
binlog-ignore-db = test
binlog-ignore-db = mysql
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log_replica_updates
#replicate-do-db
replica_skip_errors=1062,1396
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test
default_storage_engine = InnoDB
innodb_data_home_dir = {$SERVER_APP_PATH}/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
innodb_buffer_pool_size = 16M
innodb_redo_log_capacity=10485760
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
binlog_expire_logs_seconds=2592000
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
+29 -22
View File
@@ -94,21 +94,21 @@ def getConf():
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getDbServerId():
file = getConf()
content = mw.readFile(file)
rep = 'server-id\s*=\s*(.*)'
rep = r'server-id\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getSocketFile():
file = getConf()
content = mw.readFile(file)
rep = 'socket\s*=\s*(.*)'
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
socket = tmp.groups()[0].strip()
@@ -118,14 +118,14 @@ def getSocketFile():
def getErrorLogsFile():
file = getConf()
content = mw.readFile(file)
rep = 'log-error\s*=\s*(.*)'
rep = r'log-error\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getAuthPolicy():
file = getConf()
content = mw.readFile(file)
rep = 'authentication_policy\s*=\s*(.*)'
rep = r'authentication_policy\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0].strip()
@@ -261,21 +261,21 @@ def status(version=''):
def getDataDir():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getLogBinName():
file = getConf()
content = mw.readFile(file)
rep = 'log-bin\s*=\s*(.*)'
rep = r'log-bin\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pid-file\s*=\s*(.*)'
rep = r'pid-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -394,17 +394,16 @@ def getErrorLog():
def getShowLogFile():
file = getConf()
content = mw.readFile(file)
rep = 'slow-query-log-file\s*=\s*(.*)'
rep = r'slow-query-log-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getMdb8Ver():
return ['8.0','8.1','8.2','8.3','8.4']
return ['8.0','8.1','8.2','8.3','8.4','9.0']
def pGetDbUser():
if mw.isAppleSystem():
user = mw.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
user = mw.execShell("who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
return user
return 'mysql'
@@ -601,7 +600,7 @@ def initdUinstall():
def getMyDbPos():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -652,7 +651,7 @@ def setMyDbPos(version=''):
def getMyPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -666,7 +665,7 @@ def setMyPort():
port = args['port']
file = getConf()
content = mw.readFile(file)
rep = "port\s*=\s*([0-9]+)\s*\n"
rep = r"port\s*=\s*([0-9]+)\s*\n"
content = re.sub(rep, 'port = ' + port + '\n', content)
mw.writeFile(file, content)
restart()
@@ -754,7 +753,7 @@ def setDbStatus(version):
s = 'K'
if g in emptys:
s = ''
rep = '\s*' + g + '\s*=\s*\d+(M|K|k|m|G)?\n'
rep = r'\s*' + g + r'\s*=\s*\d+(M|K|k|m|G)?\n'
c = g + ' = ' + args[g] + s + '\n'
if content.find(g) != -1:
content = re.sub(rep, '\n' + c, content, 1)
@@ -1358,7 +1357,7 @@ def addDb():
dataAccess = args['dataAccess'].strip()
ps = args['ps'].strip()
reg = "^[\w-]+$"
reg = r"^[\w-]+$"
if not re.match(reg, args['name']):
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
@@ -2125,7 +2124,7 @@ def addMasterRepSlaveUser(version=''):
# address = args['address'].strip()
# dataAccess = args['dataAccess'].strip()
reg = "^[\w-]+$"
reg = r"^[\w-]+$"
if not re.match(reg, username):
return mw.returnJson(False, '用户名不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
@@ -2501,7 +2500,7 @@ def updateSlaveSSH(version=''):
def getSlaveList(version=''):
query_status_cmd = 'show slave status'
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
mdb8 = getMdb8Ver()
if mw.inArray(mdb8, version):
query_status_cmd = 'show replica status'
@@ -3475,7 +3474,9 @@ def fullSync(version=''):
def installPreInspection(version):
arch_data = mw.execShell('arch')
if arch_data[0].strip().startswith('aarch'):
return '不支持aarch架构'
cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'"
sys = mw.execShell(cmd)
@@ -3499,11 +3500,17 @@ def installPreInspection(version):
if sysName == 'debian' and sysId == '12' and version == '8.0':
return 'debian12,暂时不支持8.0'
if version == '9.0':
if sysName == 'debian' and sysId != '12':
return '9.0 仅支持debian12'
if sysName == 'ubuntu' and sysId != '24.04':
return '9.0 仅支持ubuntu24.04'
if (sysName == 'ubuntu' and version == '5.7' and not sysId in ('18.04')):
return "Ubuntu Apt MySQL[" + version + "] 仅支持18.04"
if (sysName == 'ubuntu' and version == '8.0' and not sysId in ('18.04', '20.04', '22.04')):
return 'Ubuntu Apt MySQL[' + version + '] 仅支持18.04,20.04,22.04'
if (sysName == 'ubuntu' and version == '8.0' and not sysId in ('18.04', '20.04', '22.04','24.04')):
return 'Ubuntu Apt MySQL[' + version + '] 仅支持18.04,20.04,22.04,24.04'
return 'ok'
+1 -1
View File
@@ -6,7 +6,7 @@
"type":"运行环境",
"ps":"一种关系数据库管理系统[debian,ubuntu](极速安装)",
"todo_versions":["5.7","8.0"],
"versions":["5.7","8.0","8.2","8.3","8.4"],
"versions":["5.7","8.0","8.2","8.3","8.4","9.0"],
"shell":"install.sh",
"install_pre_inspection":true,
"uninstall_pre_inspection":true,
@@ -35,7 +35,6 @@ WantedBy=multi-user.target
User=mysql
Group=mysql
Type=notify
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
LimitNOFILE = 10000
@@ -0,0 +1,49 @@
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# 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 General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# MySQL systemd service file
[Unit]
Description=MySQL Community Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
Type=notify
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
# Always restart when mysqld exits with exit code of 16. This special exit code
# is used by mysqld for RESTART SQL.
RestartForceExitStatus=16
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment=MYSQLD_PARENT_PID=1
+2 -2
View File
@@ -31,12 +31,12 @@ fi
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
echo '缺少安装脚本...'
exit 0
fi
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
echo '缺少安装脚本2...'
exit 0
fi
+3 -3
View File
@@ -45,7 +45,7 @@ if [ "$ARCH" != "amd64" ];then
fi
MYSQL_VER=8.4.0
MYSQL_VER=8.4.2
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
@@ -112,10 +112,10 @@ Install_mysql()
if [ "$?" == "0" ];then
mkdir -p $serverPath/mysql-apt
echo '8.4' > $serverPath/mysql-apt/version.pl
echo '安装完成' > $install_tmp
echo '安装完成' >
else
echo '8.4' > $serverPath/mysql-apt/version.pl
echo "暂时不支持该系统" > $install_tmp
echo "暂时不支持该系统"
fi
}
+139
View File
@@ -0,0 +1,139 @@
# -*- coding: utf-8 -*-
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
export DEBIAN_FRONTEND=noninteractive
# https://downloads.mysql.com/archives/community/
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
myDir=${serverPath}/source/mysql-apt
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0
# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
# exit 1
# fi
ARCH="amd64"
TMP_ARCH=`arch`
if [ "$TMP_ARCH" == "x86_64" ];then
ARCH="amd64"
elif [ "$TMP_ARCH" == "aarch64" ];then
ARCH="arm64"
else
ARCH="amd64"
fi
if [ "$ARCH" != "amd64" ];then
echo "暂时不支持该${ARCH}" > $install_tmp
exit 1
fi
MYSQL_VER=9.0.1
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
# /lib/systemd/system/mysql.service
# /etc/mysql/my.cnf
APT_INSTALL()
{
########
mkdir -p $myDir
mkdir -p $serverPath/mysql-apt/bin
mkdir -p /var/run/mysqld
chown mysql -R /var/run/mysqld
# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
apt update -y
apt install -y libnuma1 libaio1 libmecab2
# 安装
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
# 测试时可关闭
rm -rf $myDir
#######
}
APT_UNINSTALL()
{
###
rm -rf $myDir
# apt remove -y mysql-server
###
}
Install_mysql()
{
echo '正在安装脚本文件...' > $install_tmp
isApt=`which apt`
if [ "$isApt" != "" ];then
APT_INSTALL
fi
if [ "$?" == "0" ];then
mkdir -p $serverPath/mysql-apt
echo '9.0' > $serverPath/mysql-apt/version.pl
echo '安装完成'
else
echo '9.0' > $serverPath/mysql-apt/version.pl
echo "暂时不支持该系统"
fi
}
Uninstall_mysql()
{
isApt=`which apt`
if [ "$isApt" != "" ];then
APT_UNINSTALL
fi
rm -rf $serverPath/mysql-apt
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_mysql
else
Uninstall_mysql
fi
+104
View File
@@ -0,0 +1,104 @@
[client]
user = root
#password = your_password
port = 33206
socket = {$SERVER_APP_PATH}/mysql.sock
default-character-set = UTF8MB4
[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
#mysql_native_password=ON
authentication_policy=caching_sha2_password
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
user = mysql
port = 33206
#mysqlx_port = 33260
socket = {$SERVER_APP_PATH}/mysql.sock
datadir = {$SERVER_APP_PATH}/data
log-error = {$SERVER_APP_PATH}/data/error.log
server-id = {$SERVER_ID}
default_storage_engine = InnoDB
key_buffer_size = 8M
table_open_cache = 32
sort_buffer_size = 256K
net_buffer_length = 4K
read_buffer_size = 128K
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 4M
thread_cache_size = 4
lower_case_table_names=1
tmp_table_size = 8M
character-set-server = UTF8MB4
max_connections = 500
max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M
#skip-external-locking
#skip-grant-tables
#loose-skip-innodb
#skip-networking
#skip-name-resolve
log-bin=mysql-bin
slow_query_log=1
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on
relay-log=mdserver
relay-log-index=mdserver
#master
#binlog-do-db
#sync_binlog=1
binlog-ignore-db = test
binlog-ignore-db = mysql
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log_replica_updates
#replicate-do-db
replica_skip_errors=1062,1396
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test
default_storage_engine = InnoDB
innodb_data_home_dir = {$SERVER_APP_PATH}/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
innodb_buffer_pool_size = 16M
innodb_redo_log_capacity=10485760
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
binlog_expire_logs_seconds=2592000
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
+1 -1
View File
@@ -390,7 +390,7 @@ def getShowLogFile():
return tmp.groups()[0].strip()
def getMdb8Ver():
return ['8.0','8.1','8.2','8.3','8.4']
return ['8.0','8.1','8.2','8.3','8.4','9.0']
def pGetDbUser():
if mw.isAppleSystem():
+1 -1
View File
@@ -5,7 +5,7 @@
"name":"mysql-yum",
"type":"运行环境",
"ps":"一种关系数据库管理系统[centos](极速安装)",
"versions":["5.7","8.0","8.2","8.3", "8.4"],
"versions":["5.7","8.0","8.2","8.3", "8.4", "9.0"],
"shell":"install.sh",
"install_pre_inspection":true,
"uninstall_pre_inspection":true,
@@ -0,0 +1,63 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to use systemctl edit:
#
# $ systemctl edit mysqld.service
#
# this will create file
#
# /etc/systemd/system/mysqld.service.d/override.conf
#
# which be parsed after the file mysqld.service itself is parsed.
#
# For example, if you want to increase mysql's open-files-limit to 20000
# add following when editing with command above:
#
# [Service]
# LimitNOFILE=20000
#
# Or if you require to execute pre and post scripts in the unit file as root, set
# PermissionsStartOnly=true
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
#
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload
[Unit]
Description=MySQL 8.0 database server
After=syslog.target
After=network.target
[Service]
Type=notify
User=mysql
Group=mysql
#ExecStartPre=/usr/libexec/mysql-check-socket
#ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart={$SERVER_PATH}/mysql-yum/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-yum/etc/my.cnf --basedir={$SERVER_PATH}/mysql-yum/bin/usr --user=mysql
#ExecStartPost=/usr/libexec/mysql-check-upgrade
#ExecStopPost=/usr/libexec/mysql-wait-stop
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
# Place temp files in a secure directory, not /tmp
PrivateTmp=false
Restart=on-failure
RestartPreventExitStatus=1
# Sets open_files_limit
LimitNOFILE = 10000
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
Environment=MYSQLD_PARENT_PID=1
[Install]
WantedBy=multi-user.target
+3 -2
View File
@@ -83,8 +83,9 @@ chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-5.7/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-5.7/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
+2 -2
View File
@@ -80,9 +80,9 @@ chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
+2 -2
View File
@@ -81,8 +81,8 @@ chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
+2 -2
View File
@@ -81,8 +81,8 @@ chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
+2 -2
View File
@@ -84,8 +84,8 @@ chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
+156
View File
@@ -0,0 +1,156 @@
# -*- coding: utf-8 -*-
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# https://downloads.mysql.com/archives/community/
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
myDir=${serverPath}/source/mysql-yum
ARCH=`uname -m`
ARCH_NAME=''
case $(uname -m) in
i386) ARCH_NAME="386" ;;
i686) ARCH_NAME="386" ;;
x86_64) ARCH_NAME="amd64" ;;
arm) ARCH_NAME="arm64" ;;
esac
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
echo "VERSION_ID:${VERSION_ID}"
OS_SIGN=1.el9
if [ "$OSNAME" == "centos" ];then
OS_SIGN=1.el${VERSION_ID}
elif [ "$OSNAME" == "fedora" ]; then
OS_SIGN=10.fc${VERSION_ID}
elif [ "$OSNAME" == "opensuse" ]; then
OS_SIGN=1.sl${VERSION_ID:0:2}
fi
MYSQL_VER=9.0.1
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
YUM_INSTALL()
{
mkdir -p /var/run/mysqld
chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
# https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
#######
}
ZYPPER_INSTALL()
{
zypper install -y libstdc++6
mkdir -p /var/run/mysqld
chown mysql -R /var/run/mysqld
#######
mkdir -p $myDir
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
#######
}
YUM_UNINSTALL()
{
### YUM卸载 START ########
# yum -y remove mysql-server
rm -rf ${myDir}
### YUM卸载 END ########
}
Install_mysql()
{
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/mysql-yum
mkdir -p /var/lib/mysql
chown mysql -R /var/lib/mysql/
isYum=`which yum`
if [ "$isYum" != "" ];then
YUM_INSTALL
fi
isZypper=`which zypper`
if [ "$isZypper" != "" ];then
ZYPPER_INSTALL
fi
rm -rf $myDir
echo '9.0' > $serverPath/mysql-yum/version.pl
echo '安装完成'
}
Uninstall_mysql()
{
YUM_UNINSTALL
rm -rf $serverPath/mysql-yum
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_mysql
else
Uninstall_mysql
fi
+113
View File
@@ -0,0 +1,113 @@
[client]
user = root
#password = your_password
port = 3306
socket = {$SERVER_APP_PATH}/mysql.sock
default-character-set = UTF8MB4
[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
authentication_policy=caching_sha2_password
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
user = mysql
port = 3306
socket = {$SERVER_APP_PATH}/mysql.sock
basedir = {$SERVER_APP_PATH}
datadir = {$SERVER_APP_PATH}/data
log-error = {$SERVER_APP_PATH}/data/error.log
server-id = {$SERVER_ID}
#sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
default_storage_engine = InnoDB
key_buffer_size = 8M
table_open_cache = 32
sort_buffer_size = 256K
net_buffer_length = 4K
read_buffer_size = 128K
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 4M
thread_cache_size = 4
lower_case_table_names=0
tmp_table_size = 8M
character-set-server = UTF8MB4
max_connections = 500
max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M
skip_name_resolve=1
#skip-networking
#skip-external-locking
#loose-skip-innodb
#skip-grant-tables
log-bin=mysql-bin
slow_query_log=1
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
long_query_time=10
#log_queries_not_using_indexes=1
#log_slow_admin_statements=1
#log_slow_replica_statements=1
binlog_expire_logs_seconds=2592000
relay-log=mdserver
relay-log-index=mdserver
#多主设置
#auto_increment_offset=2
#auto_increment_increment=2
#master
#sync_binlog=1
#binlog-do-db
binlog-ignore-db = test
binlog-ignore-db = mysql
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log_replica_updates = 1
# Prevent replication from starting automatically with MySQL
#skip_replica_start = 1
#replicate-do-db
replica_skip_errors=1062,1396
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test
innodb_data_home_dir = {$SERVER_APP_PATH}/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
innodb_buffer_pool_size = 16M
#innodb_log_file_size = 5M
innodb_redo_log_capacity=10485760
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
+18 -19
View File
@@ -88,7 +88,7 @@ def getConf():
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -96,7 +96,7 @@ def getDbPort():
def getDbServerId():
file = getConf()
content = mw.readFile(file)
rep = 'server-id\s*=\s*(.*)'
rep = r'server-id\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -104,7 +104,7 @@ def getDbServerId():
def getSocketFile():
file = getConf()
content = mw.readFile(file)
rep = 'socket\s*=\s*(.*)'
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -112,14 +112,14 @@ def getSocketFile():
def getErrorLogsFile():
file = getConf()
content = mw.readFile(file)
rep = 'log-error\s*=\s*(.*)'
rep = r'log-error\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getAuthPolicy():
file = getConf()
content = mw.readFile(file)
rep = 'authentication_policy\s*=\s*(.*)'
rep = r'authentication_policy\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0].strip()
@@ -302,7 +302,7 @@ def status(version=''):
def getDataDir():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -310,7 +310,7 @@ def getDataDir():
def getLogBinName():
file = getConf()
content = mw.readFile(file)
rep = 'log-bin\s*=\s*(.*)'
rep = r'log-bin\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -318,7 +318,7 @@ def getLogBinName():
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pid-file\s*=\s*(.*)'
rep = r'pid-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -424,13 +424,13 @@ def getErrorLog():
def getShowLogFile():
file = getConf()
content = mw.readFile(file)
rep = 'slow-query-log-file\s*=\s*(.*)'
rep = r'slow-query-log-file\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getMdb8Ver():
return ['8.0','8.1','8.2','8.3','8.4']
return ['8.0','8.1','8.2','8.3','8.4','9.0']
def pGetDbUser():
if mw.isAppleSystem():
@@ -743,7 +743,7 @@ def initdUinstall():
def getMyDbPos():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -793,7 +793,7 @@ def setMyDbPos(version):
def getMyPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -807,7 +807,7 @@ def setMyPort(version):
port = args['port']
file = getConf()
content = mw.readFile(file)
rep = "port\s*=\s*([0-9]+)\s*\n"
rep = r"port\s*=\s*([0-9]+)\s*\n"
content = re.sub(rep, 'port = ' + port + '\n', content)
mw.writeFile(file, content)
restart(version)
@@ -898,7 +898,7 @@ def setDbStatus(version):
s = 'K'
if g in emptys:
s = ''
rep = '\s*' + g + '\s*=\s*\d+(M|K|k|m|G)?\n'
rep = r'\s*' + g + r'\s*=\s*\d+(M|K|k|m|G)?\n'
c = g + ' = ' + args[g] + s + '\n'
if content.find(g) != -1:
content = re.sub(rep, '\n' + c, content, 1)
@@ -1571,7 +1571,7 @@ def addDb():
dataAccess = args['dataAccess'].strip()
ps = args['ps'].strip()
reg = "^[\w-]+$"
reg = r"^[\w-]+$"
if not re.match(reg, args['name']):
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
@@ -2163,8 +2163,7 @@ def setDbMaster(version):
if not isHas:
prefix = '#binlog-do-db'
con = con.replace(
prefix, prefix + "\nbinlog-do-db=" + args['name'])
con = con.replace(prefix, prefix + "\nbinlog-do-db=" + args['name'])
mw.writeFile(conf, con)
restart(version)
@@ -2326,7 +2325,7 @@ def addMasterRepSlaveUser(version=''):
# address = args['address'].strip()
# dataAccess = args['dataAccess'].strip()
reg = "^[\w-]+$"
reg = r"^[\w-]+$"
if not re.match(reg, username):
return mw.returnJson(False, '用户名不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
@@ -3392,7 +3391,7 @@ def doFullSyncUserImportContentForChannel(file, channel_name):
content = content.replace('STOP SLAVE;', "STOP SLAVE for channel '{}';".format(channel_name))
content = content.replace('START SLAVE;', "START SLAVE for channel '{}';".format(channel_name))
find_head = "CHANGE MASTER TO "
find_head = r"CHANGE MASTER TO "
find_re = find_head+"(.*?);"
find_r = re.search(find_re, content, re.I|re.M)
if find_r:
+2 -2
View File
@@ -10,8 +10,8 @@
"checks": "server/mysql/VERSION/bin/mysql",
"path": "server/mysql/VERSION",
"todo_versions":["5.6","5.7","8.0","8.2"],
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4"],
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0"],
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0"],
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1"],
"shell":"install.sh",
"checks":"server/mysql",
"path":"server/mysql",
@@ -0,0 +1,37 @@
diff -ruN mysql-5.5.42.orig/sql-common/client_plugin.c mysql-5.5.42/sql-common/client_plugin.c
--- mysql-5.5.42.orig/sql-common/client_plugin.c 2015-01-07 04:39:40.000000000 +0800
+++ mysql-5.5.42/sql-common/client_plugin.c 2015-03-24 10:36:45.682700014 +0800
@@ -233,6 +233,7 @@
{
MYSQL mysql;
struct st_mysql_client_plugin **builtin;
+ va_list dummy;
if (initialized)
return 0;
@@ -249,7 +250,7 @@
pthread_mutex_lock(&LOCK_load_client_plugin);
for (builtin= mysql_client_builtins; *builtin; builtin++)
- add_plugin(&mysql, *builtin, 0, 0, 0);
+ add_plugin(&mysql, *builtin, 0, 0, dummy);
pthread_mutex_unlock(&LOCK_load_client_plugin);
@@ -293,6 +294,7 @@
mysql_client_register_plugin(MYSQL *mysql,
struct st_mysql_client_plugin *plugin)
{
+ va_list dummy;
if (is_not_initialized(mysql, plugin->name))
return NULL;
@@ -307,7 +309,7 @@
plugin= NULL;
}
else
- plugin= add_plugin(mysql, plugin, 0, 0, 0);
+ plugin= add_plugin(mysql, plugin, 0, 0, dummy);
pthread_mutex_unlock(&LOCK_load_client_plugin);
return plugin;
+62 -1
View File
@@ -10,12 +10,53 @@ rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
sysArch=`arch`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
VERSION=5.5.62
_os=`uname`
echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
pkg install -y wget unzip
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
OSNAME='arch'
echo y | pacman -Sy unzip
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
else
OSNAME='unknow'
fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
Install_mysql()
{
mkdir -p ${mysqlDir}
@@ -69,6 +110,27 @@ Install_mysql()
WHERE_DIR_GPP=`which g++`
fi
# https://blog.whsir.com/post-7748.html
# arm架构编译MySQL5.5报错
if [[ "$sysArch" =~ "aarch" ]];then
# wget --no-check-certificate -O ${mysqlDir}/mysql-5.5-fix-arm-client_plugin.patch https://down.whsir.com/downloads/mysql-5.5-fix-arm-client_plugin.patch
cd ${mysqlDir}/mysql-5.5.62 && patch -p1 < ${rootPath}/plugins/mysql/patch/mysql-5.5-fix-arm-client_plugin.patch
fi
if [ "$OSNAME" == "ubuntu" ];then
apt install -y libudev-dev
apt install -y libtirpc-dev
apt install -y libssl-dev
apt install -y libgssglue-dev
apt install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
apt install -y gcc-10 g++-10
WHERE_DIR_GCC=/usr/bin/gcc-10
WHERE_DIR_GPP=/usr/bin/g++-10
fi
if [ ! -d $serverPath/mysql ];then
cd ${mysqlDir}/mysql-5.5.62 && cmake \
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
@@ -94,7 +156,6 @@ Install_mysql()
else
# rm -rf ${mysqlDir}/mysql-5.5.62
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
+70 -8
View File
@@ -11,12 +11,52 @@ rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
sysArch=`arch`
_os=`uname`
echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
pkg install -y wget unzip
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
OSNAME='arch'
echo y | pacman -Sy unzip
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
else
OSNAME='unknow'
fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
VERSION=5.6.50
VERSION=5.6.51
Install_mysql()
{
mkdir -p ${mysqlDir}
@@ -61,6 +101,29 @@ Install_mysql()
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-${VERSION}.tar.gz
fi
WHERE_DIR_GCC=/usr/bin/gcc
WHERE_DIR_GPP=/usr/bin/g++
if [ ! -f $WHERE_DIR_GCC ];then
WHERE_DIR_GCC=`which gcc`
fi
if [ ! -f $WHERE_DIR_GPP ];then
WHERE_DIR_GPP=`which g++`
fi
if [ "$OSNAME" == "ubuntu" ];then
apt install -y libudev-dev
apt install -y libtirpc-dev
apt install -y libssl-dev
apt install -y libgssglue-dev
apt install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
apt install -y gcc-11 g++-11
WHERE_DIR_GCC=/usr/bin/gcc-11
WHERE_DIR_GPP=/usr/bin/g++-11
fi
OPTIONS=''
##check openssl version
@@ -68,8 +131,8 @@ Install_mysql()
if [ "${OPENSSL_VERSION}" -ge "3" ];then
#openssl version to high
cd ${rootPath}/plugins/php/lib && /bin/bash openssl10.sh
export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl10"
export PKG_CONFIG_PATH=$serverPath/lib/openssl11/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl11"
fi
if [ ! -d $serverPath/mysql ];then
@@ -88,8 +151,8 @@ Install_mysql()
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
$OPTIONS \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DCMAKE_C_COMPILER=$WHERE_DIR_GCC \
-DCMAKE_CXX_COMPILER=$WHERE_DIR_GPP \
-DCMAKE_CXX_STANDARD=11
make -j${cpuCore} && make install && make clean
@@ -100,9 +163,8 @@ Install_mysql()
echo '5.6' > $serverPath/mysql/version.pl
echo "${VERSION}安装完成"
else
# rm -rf ${mysqlDir}/mysql-5.6.50
# rm -rf ${mysqlDir}/mysql-5.6.*
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
@@ -111,7 +173,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+68 -6
View File
@@ -16,7 +16,46 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
VERSION=5.7.39
VERSION=5.7.44
_os=`uname`
echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
pkg install -y wget unzip
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
OSNAME='arch'
echo y | pacman -Sy unzip
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
else
OSNAME='unknow'
fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
Install_mysql()
@@ -61,7 +100,7 @@ Install_mysql()
fi
#检测文件是否损坏.
md5_mysql_ok=d949b0ef81c3f52f7ef0874066244221
md5_mysql_ok=1a637fce4599d9bf5f1c81699f086274
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
@@ -77,6 +116,30 @@ Install_mysql()
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-${VERSION}.tar.gz
fi
WHERE_DIR_GCC=/usr/bin/gcc
WHERE_DIR_GPP=/usr/bin/g++
if [ ! -f $WHERE_DIR_GCC ];then
WHERE_DIR_GCC=`which gcc`
fi
if [ ! -f $WHERE_DIR_GPP ];then
WHERE_DIR_GPP=`which g++`
fi
if [ "$OSNAME" == "ubuntu" ];then
apt install -y libudev-dev
apt install -y libtirpc-dev
apt install -y libssl-dev
apt install -y libgssglue-dev
apt install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
apt install -y gcc-11 g++-11
WHERE_DIR_GCC=/usr/bin/gcc-11
WHERE_DIR_GPP=/usr/bin/g++-11
fi
OPTIONS=''
##check openssl version
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
@@ -103,8 +166,8 @@ Install_mysql()
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
$OPTIONS \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DCMAKE_C_COMPILER=${WHERE_DIR_GCC} \
-DCMAKE_CXX_COMPILER=${WHERE_DIR_GPP} \
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
make -j${cpuCore} && make install && make clean
@@ -115,7 +178,6 @@ Install_mysql()
else
# rm -rf ${mysqlDir}/mysql-${VERSION}
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
@@ -124,7 +186,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+1 -2
View File
@@ -207,7 +207,6 @@ Install_mysql()
else
# rm -rf ${mysqlDir}/mysql-${VERSION}
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
@@ -216,7 +215,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+1 -2
View File
@@ -207,7 +207,6 @@ Install_mysql()
else
# rm -rf ${mysqlDir}/mysql-${VERSION}
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
@@ -216,7 +215,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+1 -2
View File
@@ -206,7 +206,6 @@ Install_mysql()
else
# rm -rf ${mysqlDir}/mysql-${VERSION}
echo "${VERSION}安装失败"
echo 'install fail'>&2
exit 1
fi
fi
@@ -215,7 +214,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+4 -4
View File
@@ -56,7 +56,7 @@ fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
VERSION=8.4.0
VERSION=8.4.2
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${VERSION}.tar.gz
# https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-boost-${VERSION}.tar.gz
Install_mysql()
@@ -106,11 +106,11 @@ Install_mysql()
fi
#检测文件是否损坏.
md5_mysql_ok=8c2399782217f5391322751c66ea261b
md5_mysql_ok=a632063fdb1c7de2c5db47e1f66191cd
if [ -f ${mysqlDir}/mysql-${VERSION}.tar.gz ];then
md5_mysql=`md5sum ${mysqlDir}/mysql-${VERSION}.tar.gz | awk '{print $1}'`
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
echo "mysql8.3 file check ok"
echo "mysql8.4 file check ok"
else
# 重新下载
rm -rf ${mysqlDir}/mysql-${VERSION}
@@ -217,7 +217,7 @@ Install_mysql()
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成' > $install_tmp
echo '卸载完成'
}
action=$1
+232
View File
@@ -0,0 +1,232 @@
# -*- coding: utf-8 -*-
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
#https://dev.mysql.com/downloads/mysql/5.7.html
#https://dev.mysql.com/downloads/file/?id=489855
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
_os=`uname`
echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
pkg install -y wget unzip
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
OSNAME='arch'
echo y | pacman -Sy unzip
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
else
OSNAME='unknow'
fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
VERSION=9.0.1
# https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-${VERSION}.tar.gz
# https://cdn.mysql.com//Downloads/MySQL-9.0/mysql-boost-${VERSION}.tar.gz
Install_mysql()
{
mkdir -p ${mysqlDir}
echo '正在安装脚本文件...' > $install_tmp
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
INSTALL_CMD=cmake
# check cmake version
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
if [ "$CMAKE_VERSION" -eq "2" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
INSTALL_CMD=cmake3
fi
if [ ! -f ${mysqlDir}/mysql-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${mysqlDir}/mysql-${VERSION}.tar.gz --tries=3 https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-${VERSION}.tar.gz
fi
#检测文件是否损坏.
md5_mysql_ok=90dc27a8b64eee938a0bb045c580b80c
if [ -f ${mysqlDir}/mysql-${VERSION}.tar.gz ];then
md5_mysql=`md5sum ${mysqlDir}/mysql-${VERSION}.tar.gz | awk '{print $1}'`
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
echo "mysql9.0 file check ok"
else
# 重新下载
rm -rf ${mysqlDir}/mysql-${VERSION}
wget --no-check-certificate -O ${mysqlDir}/mysql-${VERSION}.tar.gz --tries=3 https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-${VERSION}.tar.gz
fi
fi
if [ ! -d ${mysqlDir}/mysql-${VERSION} ];then
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-${VERSION}.tar.gz
fi
OPTIONS=''
##check openssl version
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
if [ "${OPENSSL_VERSION}" -ge "3" ];then
#openssl version to high
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
fi
WHERE_DIR_GCC=/usr/bin/gcc
WHERE_DIR_GPP=/usr/bin/g++
if [ "$OSNAME" == "centos" ] && [ "$VERSION_ID" == "7" ];then
yum install -y libudev-devel
yum install -y centos-release-scl
yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
gcc --version
WHERE_DIR_GCC=/opt/rh/devtoolset-11/root/usr/bin/gcc
WHERE_DIR_GPP=/opt/rh/devtoolset-11/root/usr/bin/g++
echo $WHERE_DIR_GCC
echo $WHERE_DIR_GPP
fi
if [ "$OSNAME" == "ubuntu" ];then
apt install -y libudev-dev
apt install -y libtirpc-dev
apt install -y libssl-dev
apt install -y libgssglue-dev
apt install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
LIBTIRPC_VER=`pkg-config libtirpc --modversion`
if [ ! -f ${mysqlDir}/libtirpc_1.3.3.orig.tar.bz2 ];then
wget --no-check-certificate -O ${mysqlDir}/libtirpc_1.3.3.orig.tar.bz2 https://downloads.sourceforge.net/libtirpc/libtirpc-1.3.3.tar.bz2
cd ${mysqlDir} && tar -jxvf libtirpc_1.3.3.orig.tar.bz2
cd libtirpc-1.3.3 && ./configure
fi
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
apt install -y gcc-11 g++-11
WHERE_DIR_GCC=/usr/bin/gcc-11
WHERE_DIR_GPP=/usr/bin/g++-11
OPTIONS="${OPTIONS} -DFORCE_INSOURCE_BUILD=1"
OPTIONS="${OPTIONS} -D_FORTIFY_SOURCE=2"
fi
if [ "$OSNAME" == "opensuse" ];then
zypper install -y gcc11
zypper install -y gcc11-c++
WHERE_DIR_GCC=/usr/bin/gcc-11
WHERE_DIR_GPP=/usr/bin/g++-11
fi
if [ ! -d $serverPath/mysql ];then
# -DCMAKE_CXX_STANDARD=17 \
cd ${mysqlDir}/mysql-${VERSION} && ${INSTALL_CMD} \
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/var/tmp/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
-DFORCE_INSOURCE_BUILD=1 \
$OPTIONS \
-DCMAKE_C_COMPILER=$WHERE_DIR_GCC \
-DCMAKE_CXX_COMPILER=$WHERE_DIR_GPP \
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mysql ];then
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '9.0' > $serverPath/mysql/version.pl
echo "${VERSION}安装完成"
else
# rm -rf ${mysqlDir}/mysql-${VERSION}
echo "${VERSION}安装失败"
exit 1
fi
fi
}
Uninstall_mysql()
{
rm -rf $serverPath/mysql
echo '卸载完成'
}
action=$1
if [ "${1}" == "install" ];then
Install_mysql
else
Uninstall_mysql
fi
+5 -5
View File
@@ -106,7 +106,7 @@ def getInitDTpl():
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pid\s*(.*);'
rep = r'pid\s*(.*);'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -457,7 +457,7 @@ def getCfg():
# {"name": "client_body_buffer_size", "ps": "请求主体缓冲区"}
rdata = []
for i in cfg_args:
rep = "(%s)\s+(\w+)" % i["name"]
rep = r"(%s)\s+(\w+)" % i["name"]
k = re.search(rep, content)
if not k:
return mw.returnJson(False, "获取 key {} 失败".format(k))
@@ -516,12 +516,12 @@ def setCfg():
# print(args)
for k, v in args.items():
# print(k, v)
rep = "%s\s+[^kKmMgG\;\n]+" % k
rep = r"%s\s+[^kKmMgG\;\n]+" % k
if k == "worker_processes" or k == "gzip":
if not re.search("auto|on|off|\d+", v):
if not re.search(r"auto|on|off|\d+", v):
return mw.returnJson(False, '参数值错误')
else:
if not re.search("\d+", v):
if not re.search(r"\d+", v):
return mw.returnJson(False, '参数值错误,请输入数字整数')
if re.search(rep, content):
+3 -3
View File
@@ -8,10 +8,10 @@
"install_pre_inspection":true,
"checks":"server/openresty",
"path":"server/openresty",
"author":"nginx/agentzh",
"author":"agentzh",
"home":"http://openresty.org",
"date":"2017-11-24",
"pid": "1",
"versions": ["1.17.8.2","1.19.3.1","1.21.4.2","1.21.4.3","1.25.3.1"],
"updates": ["1.17.8.2","1.19.3.1","1.21.4.2","1.21.4.3","1.25.3.1"]
"versions": ["1.17.8","1.19.3","1.21.4","1.25.3"],
"updates": ["1.17.8.2","1.19.3.1","1.21.4.2","1.25.3.2"]
}
+19 -182
View File
@@ -26,181 +26,12 @@ else
useradd -g www -s /bin/bash www
fi
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_openresty()
{
if [ -d $serverPath/openresty ];then
exit 0
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...'
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
fi
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
if [ "$DOWNLOAD_SIZE" == "0" ];then
echo 'download failed, download again'
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
fi
# Last Download Method
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.icu/soft/openresty/openresty-${VERSION}.tar.gz -T 3
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
OPTIONS=''
if [ "$VERSION" == "1.19.3.1" ]; then
OPTIONS="${OPTIONS} --with-ipv6"
fi
opensslVersion="1.1.1p"
libresslVersion="3.9.1"
pcreVersion='8.38'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
# BREW_DIR=`which brew`
# BREW_DIR=${BREW_DIR/\/bin\/brew/}
# brew info openssl@1.1 | grep /opt/homebrew/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
if [ "$VERSION" == "1.25.3.1" ]; then
OPTIONS="${OPTIONS} --with-http_v3_module"
if [ ! -f ${openrestyDir}/libressl-${libresslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/libressl-${libresslVersion}.tar.gz https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${libresslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/libressl-${libresslVersion} ];then
cd ${openrestyDir} && tar -zxvf libressl-${libresslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/include"
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
# --with-cc-opt="-I../libressl/build/include"
# --with-ld-opt="-L../libressl/build/lib"
fi
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
$OPTIONS \
--with-stream \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module
# --without-luajit-gc64
# --with-debug
# 用于调式
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
gmake -j${cpuCore} && gmake install && gmake clean
else
make -j${cpuCore} && make install && make clean
fi
if [ -d $serverPath/openresty ];then
echo "${VERSION}" > $serverPath/openresty/version.pl
mkdir -p $serverPath/web_conf/php/conf
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install
rm -rf $openrestyDir/openresty-${VERSION}
fi
if [ -d ${openrestyDir}/pcre-${pcreVersion} ];then
rm -rf ${openrestyDir}/pcre-${pcreVersion}
fi
if [ -d ${openrestyDir}/openssl-${opensslVersion} ];then
rm -rf ${openrestyDir}/openssl-${opensslVersion}
fi
if [ -d ${openrestyDir}/libressl-${libresslVersion} ];then
rm -rf ${openrestyDir}/libressl-${libresslVersion}
fi
echo '安装完成'
}
Uninstall_openresty()
{
if [ "${2}" == "" ];then
echo '缺少安装脚本版本...'
exit 0
fi
if [ "${action}" == "uninstall" ];then
if [ -f /usr/lib/systemd/system/openresty.service ] || [ -f /lib/systemd/system/openresty.service ];then
systemctl stop openresty
rm -rf /usr/systemd/system/openresty.service
@@ -213,12 +44,18 @@ Uninstall_openresty()
fi
rm -rf $serverPath/openresty
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/openresty ];then
echo "${VERSION}" > $serverPath/openresty/version.pl
mkdir -p $serverPath/web_conf/php/conf
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install
rm -rf $openrestyDir/openresty-${VERSION}
fi
@@ -0,0 +1,165 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
action=$1
type=$2
VERSION=1.17.8.2
install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
Install_openresty()
{
if [ -d $serverPath/openresty ];then
exit 0
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...'
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
fi
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
if [ "$DOWNLOAD_SIZE" == "0" ];then
echo 'download failed, download again'
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
fi
# Last Download Method
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.icu/soft/openresty/openresty-${VERSION}.tar.gz -T 3
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
OPTIONS=''
opensslVersion="1.1.1p"
libresslVersion="3.9.1"
pcreVersion='8.38'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
# BREW_DIR=`which brew`
# BREW_DIR=${BREW_DIR/\/bin\/brew/}
# brew info openssl@1.1 | grep /opt/homebrew/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
echo "openssl"
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
# wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
# fi
# if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
# cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
# fi
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
$OPTIONS \
--with-stream \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module
# --without-luajit-gc64
# --with-debug
# 用于调式
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
gmake -j${cpuCore} && gmake install && gmake clean
else
make -j${cpuCore} && make install && make clean
fi
if [ -d ${openrestyDir}/pcre-${pcreVersion} ];then
rm -rf ${openrestyDir}/pcre-${pcreVersion}
fi
if [ -d ${openrestyDir}/openssl-${opensslVersion} ];then
rm -rf ${openrestyDir}/openssl-${opensslVersion}
fi
if [ -d ${openrestyDir}/libressl-${libresslVersion} ];then
rm -rf ${openrestyDir}/libressl-${libresslVersion}
fi
echo '安装完成'
}
Uninstall_openresty()
{
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi
@@ -0,0 +1,166 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
action=$1
type=$2
VERSION=1.19.3.1
install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
Install_openresty()
{
if [ -d $serverPath/openresty ];then
exit 0
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...'
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
fi
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
if [ "$DOWNLOAD_SIZE" == "0" ];then
echo 'download failed, download again'
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
fi
# Last Download Method
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.icu/soft/openresty/openresty-${VERSION}.tar.gz -T 3
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
OPTIONS=''
OPTIONS="${OPTIONS} --with-ipv6"
opensslVersion="1.1.1p"
libresslVersion="3.9.1"
pcreVersion='8.38'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
# BREW_DIR=`which brew`
# BREW_DIR=${BREW_DIR/\/bin\/brew/}
# brew info openssl@1.1 | grep /opt/homebrew/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
echo "openssl"
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
# wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
# fi
# if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
# cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
# fi
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
$OPTIONS \
--with-stream \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module
# --without-luajit-gc64
# --with-debug
# 用于调式
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
gmake -j${cpuCore} && gmake install && gmake clean
else
make -j${cpuCore} && make install && make clean
fi
if [ -d ${openrestyDir}/pcre-${pcreVersion} ];then
rm -rf ${openrestyDir}/pcre-${pcreVersion}
fi
if [ -d ${openrestyDir}/openssl-${opensslVersion} ];then
rm -rf ${openrestyDir}/openssl-${opensslVersion}
fi
if [ -d ${openrestyDir}/libressl-${libresslVersion} ];then
rm -rf ${openrestyDir}/libressl-${libresslVersion}
fi
echo '安装完成'
}
Uninstall_openresty()
{
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi
@@ -0,0 +1,165 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
action=$1
type=$2
VERSION=1.21.4.4
install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
Install_openresty()
{
if [ -d $serverPath/openresty ];then
exit 0
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...'
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
fi
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
if [ "$DOWNLOAD_SIZE" == "0" ];then
echo 'download failed, download again'
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
fi
# Last Download Method
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.icu/soft/openresty/openresty-${VERSION}.tar.gz -T 3
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
OPTIONS=''
opensslVersion="1.1.1p"
libresslVersion="3.9.1"
pcreVersion='8.38'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
# BREW_DIR=`which brew`
# BREW_DIR=${BREW_DIR/\/bin\/brew/}
# brew info openssl@1.1 | grep /opt/homebrew/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
$OPTIONS \
--with-stream \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module
# --without-luajit-gc64
# --with-debug
# 用于调式
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
gmake -j${cpuCore} && gmake install && gmake clean
else
make -j${cpuCore} && make install && make clean
fi
if [ -d ${openrestyDir}/pcre-${pcreVersion} ];then
rm -rf ${openrestyDir}/pcre-${pcreVersion}
fi
if [ -d ${openrestyDir}/openssl-${opensslVersion} ];then
rm -rf ${openrestyDir}/openssl-${opensslVersion}
fi
if [ -d ${openrestyDir}/libressl-${libresslVersion} ];then
rm -rf ${openrestyDir}/libressl-${libresslVersion}
fi
echo '安装完成'
}
Uninstall_openresty()
{
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi
@@ -0,0 +1,180 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.2
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
action=$1
type=$2
VERSION=1.25.3.2
install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
Install_openresty()
{
if [ -d $serverPath/openresty ];then
exit 0
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...'
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
fi
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
if [ "$DOWNLOAD_SIZE" == "0" ];then
echo 'download failed, download again'
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
fi
# Last Download Method
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.icu/soft/openresty/openresty-${VERSION}.tar.gz -T 3
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
OPTIONS=''
opensslVersion="1.1.1p"
libresslVersion="3.9.1"
pcreVersion='8.38'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
# BREW_DIR=`which brew`
# BREW_DIR=${BREW_DIR/\/bin\/brew/}
# brew info openssl@1.1 | grep /opt/homebrew/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/openssl-${opensslVersion} ];then
cd ${openrestyDir} && tar -zxvf openssl-${opensslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
if [[ "$VERSION" =~ "1.25.3" ]]; then
OPTIONS="${OPTIONS} --with-http_v3_module"
if [ ! -f ${openrestyDir}/libressl-${libresslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/libressl-${libresslVersion}.tar.gz https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${libresslVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/libressl-${libresslVersion} ];then
cd ${openrestyDir} && tar -zxvf libressl-${libresslVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/include"
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
fi
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
$OPTIONS \
--with-stream \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module
# --without-luajit-gc64
# --with-debug
# 用于调式
CMD_MAKE=`which gmake`
if [ "$?" == "0" ];then
gmake -j${cpuCore} && gmake install && gmake clean
else
make -j${cpuCore} && make install && make clean
fi
if [ -d ${openrestyDir}/pcre-${pcreVersion} ];then
rm -rf ${openrestyDir}/pcre-${pcreVersion}
fi
if [ -d ${openrestyDir}/openssl-${opensslVersion} ];then
rm -rf ${openrestyDir}/openssl-${opensslVersion}
fi
if [ -d ${openrestyDir}/libressl-${libresslVersion} ];then
rm -rf ${openrestyDir}/libressl-${libresslVersion}
fi
echo '安装完成'
}
Uninstall_openresty()
{
echo '卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi
+24 -24
View File
@@ -98,15 +98,15 @@ def contentReplace(content, version):
content = content.replace('{$PHP_USER}', 'nobody')
content = content.replace('{$PHP_GROUP}', 'nobody')
rep = 'listen.owner\s*=\s*(.+)\r?\n'
rep = r'listen.owner\s*=\s*(.+)\r?\n'
val = ';listen.owner = nobody\n'
content = re.sub(rep, val, content)
rep = 'listen.group\s*=\s*(.+)\r?\n'
rep = r'listen.group\s*=\s*(.+)\r?\n'
val = ';listen.group = nobody\n'
content = re.sub(rep, val, content)
rep = 'user\s*=\s*(.+)\r?\n'
rep = r'user\s*=\s*(.+)\r?\n'
val = ';user = nobody\n'
content = re.sub(rep, val, content)
@@ -305,7 +305,7 @@ def getPhpConf(version):
phpini = mw.readFile(getConf(version))
result = []
for g in gets:
rep = g['name'] + '\s*=\s*([0-9A-Za-z_& ~]+)(\s*;?|\r?\n)'
rep = g['name'] + r'\s*=\s*([0-9A-Za-z_& ~]+)(\s*;?|\r?\n)'
tmp = re.search(rep, phpini)
if not tmp:
continue
@@ -324,7 +324,7 @@ def submitPhpConf(version):
phpini = mw.readFile(filename)
for g in gets:
if g in args:
rep = g + '\s*=\s*(.+)\r?\n'
rep = g + r'\s*=\s*(.+)\r?\n'
val = g + ' = ' + args[g] + '\n'
phpini = re.sub(rep, val, phpini)
mw.writeFile(filename, phpini)
@@ -341,14 +341,14 @@ def getLimitConf(version):
# print fileini, filefpm
data = {}
try:
rep = "upload_max_filesize\s*=\s*([0-9]+)M"
rep = r"upload_max_filesize\s*=\s*([0-9]+)M"
tmp = re.search(rep, phpini).groups()
data['max'] = tmp[0]
except:
data['max'] = '50'
try:
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
tmp = re.search(rep, phpfpm).groups()
data['maxTime'] = tmp[0]
except:
@@ -380,15 +380,15 @@ def setMaxTime(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
conf = re.sub(rep, "request_terminate_timeout = " + time + "\n", conf)
mw.writeFile(filefpm, conf)
fileini = getConf(version)
phpini = mw.readFile(fileini)
rep = "max_execution_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_execution_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_execution_time = " + time + "\n", phpini)
rep = "max_input_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_input_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_input_time = " + time + "\n", phpini)
mw.writeFile(fileini, phpini)
return mw.returnJson(True, '设置成功!')
@@ -406,9 +406,9 @@ def setMaxSize(version):
path = getConf(version)
conf = mw.readFile(path)
rep = u"\nupload_max_filesize\s*=\s*[0-9]+M"
rep = r"\nupload_max_filesize\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\nupload_max_filesize = ' + maxVal + 'M', conf)
rep = u"\npost_max_size\s*=\s*[0-9]+M"
rep = r"\npost_max_size\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\npost_max_size = ' + maxVal + 'M', conf)
mw.writeFile(path, conf)
@@ -422,23 +422,23 @@ def getFpmConfig(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
data = {}
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_children'] = tmp[0]
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['start_servers'] = tmp[0]
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['min_spare_servers'] = tmp[0]
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_spare_servers'] = tmp[0]
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
tmp = re.search(rep, conf).groups()
data['pm'] = tmp[0]
return mw.getJson(data)
@@ -459,21 +459,21 @@ def setFpmConfig(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.start_servers = " + start_servers, conf)
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.min_spare_servers = " +
min_spare_servers, conf)
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_spare_servers = " +
max_spare_servers + "\n", conf)
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
mw.writeFile(filefpm, conf)
@@ -709,7 +709,7 @@ def getDisableFunc(version):
phpini = mw.readFile(filename)
data = {}
rep = "disable_functions\s*=\s{0,1}(.*)\n"
rep = r"disable_functions\s*=\s{0,1}(.*)\n"
tmp = re.search(rep, phpini).groups()
data['disable_functions'] = tmp[0]
return mw.getJson(data)
@@ -724,7 +724,7 @@ def setDisableFunc(version):
disable_functions = args['disable_functions']
phpini = mw.readFile(filename)
rep = "disable_functions\s*=\s*.*\n"
rep = r"disable_functions\s*=\s*.*\n"
phpini = re.sub(rep, 'disable_functions = ' +
disable_functions + "\n", phpini)
+2 -2
View File
@@ -69,7 +69,7 @@ def status_progress(version):
def getPhpSocket(version):
path = getFpmConfFile(version)
content = mw.readFile(path)
rep = 'listen\s*=\s*(.*)'
rep = r'listen\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -116,7 +116,7 @@ def getPhpinfo(version):
return 'PHP[' + version + ']未启动,不可访问!!!'
sock_file = getFpmAddress(version)
print(sock_file)
# print(sock_file)
root_dir = mw.getRootDir() + '/phpinfo'
mw.execShell("rm -rf " + root_dir)
+1 -1
View File
@@ -5,7 +5,7 @@
"name": "php-apt",
"title": "PHP[APT]",
"coexist": true,
"versions": ["56","70","71","72","73","74","80","81","82","83"],
"versions": ["56","70","71","72","73","74","80","81","82","83","84"],
"install_pre_inspection":true,
"tip": "soft",
"checks": "server/php-apt/VERSION",
-1
View File
@@ -44,7 +44,6 @@ if [ ! -d $curPath/versions/$2 ];then
fi
if [ "$OSNAME" == "ubuntu" ];then
find_source=`ls /etc/apt/sources.list.d | grep ondrej-ubuntu-php`
if [ "$find_source" == "" ];then
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
#获取信息和版本
# bash /www/server/mdsever-web/scripts/getos.sh
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
version=8.4
PHP_VER=84
Install_php()
{
#------------------------ install start ------------------------------------#
apt -y install php${version} php${version}-fpm php${version}-dev
if [ "$?" == "0" ];then
mkdir -p $serverPath/php-apt/${PHP_VER}
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
#------------------------ uninstall start ------------------------------------#
apt -y remove php${version} php${version}-*
rm -rf $serverPath/php-apt/${PHP_VER}
echo "卸载php-${version}..."
#------------------------ uninstall start ------------------------------------#
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
+1 -1
View File
@@ -17,7 +17,7 @@ sysName=`uname`
LIBNAME=ioncube
LIBV=0
if [ `echo "$version > 7.4"|bc` -eq 1 ];then
if [ `echo "$version > 8.3"|bc` -eq 1 ];then
echo "I won't support it"
exit 0
fi
+10 -6
View File
@@ -18,10 +18,10 @@ LIBNAME=phalcon
LIBV=0
if [ `echo "$version > 7.4"|bc` -eq 1 ];then
echo "I won't support it"
exit 0
fi
# if [ `echo "$version > 7.4"|bc` -eq 1 ];then
# echo "I won't support it"
# exit 0
# fi
CMD='apt '
if [ "$actionType" == 'install' ];then
@@ -43,9 +43,13 @@ elif [[ "$version" == '7.3' ]]; then
elif [[ "$version" == '7.4' ]]; then
CMD="${CMD}phalcon4"
elif [[ "$version" == '8.0' ]]; then
CMD="${CMD}phalcon4"
CMD="${CMD}phalcon5"
elif [[ "$version" == '8.1' ]]; then
CMD="${CMD}phalcon4"
CMD="${CMD}phalcon5"
elif [[ "$version" == '8.2' ]]; then
CMD="${CMD}phalcon5"
elif [[ "$version" == '8.3' ]]; then
CMD="${CMD}phalcon5"
fi
$CMD
+1 -3
View File
@@ -15,14 +15,12 @@ version=$2
sysName=`uname`
LIBNAME=yaf
LIBV=3.3.5
LIBV=3.3.6
if [ `echo "$version < 7.0"|bc` -eq 1 ];then
LIBV=2.3.5
fi
extVer=`bash $curPath/lib.sh $version`
extFile=/usr/lib/php/${extVer}/${LIBNAME}.so
+6 -2
View File
@@ -15,12 +15,16 @@ version=$2
sysName=`uname`
LIBNAME=yar
LIBV=2.3.2
LIBV=2.3.3
if [ `echo "$version < 7.0"|bc` -eq 1 ];then
if [[ "$version" =~ "5.0" ]];then
LIBV=1.2.5
fi
if [[ "$version" =~ "7.0" ]];then
LIBV=2.3.3
fi
extVer=`bash $curPath/lib.sh $version`
extFile=/usr/lib/php/${extVer}/${LIBNAME}.so
+72 -34
View File
@@ -11,7 +11,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "数据库访问抽象模块!",
@@ -30,7 +31,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用MySQL数据库的模块!",
@@ -49,7 +51,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用MySQL数据库的模块!",
@@ -68,7 +71,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用sqlite3数据库的模块!",
@@ -95,7 +99,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用ODBC数据库的模块!",
@@ -129,7 +134,10 @@
"71",
"72",
"73",
"74"
"74",
"81",
"82",
"83"
],
"type": "脚本解密",
"msg": "用于解密ionCube Encoder加密脚本!",
@@ -148,7 +156,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "用于加速PHP脚本!",
@@ -182,7 +191,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "高精度计算!",
@@ -199,7 +209,10 @@
"73",
"74",
"80",
"81"
"81",
"82",
"83",
"84"
],
"type": "通用扩展",
"msg": "用于FILE!",
@@ -216,7 +229,10 @@
"73",
"74",
"80",
"81"
"81",
"82",
"83",
"84"
],
"type": "通用扩展",
"msg": "用于图像文件格式!",
@@ -235,7 +251,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "序列化扩展!",
@@ -252,7 +269,10 @@
"73",
"74",
"80",
"81"
"81",
"82",
"83",
"84"
],
"type": "通用扩展",
"msg": "用于xml解析!",
@@ -266,7 +286,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "通用CURL库!",
@@ -280,7 +301,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "通用GD库!",
@@ -299,7 +321,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "提供国际化支持",
@@ -330,7 +353,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "强大的内容缓存器,支持集群",
@@ -349,7 +373,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "更强大的内容缓存器,支持集群",
@@ -368,7 +393,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "脚本缓存器",
@@ -387,7 +413,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "比GD更强大的图形库",
@@ -406,7 +433,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "调试器",
"msg": "不多说,不了解的不要安装",
@@ -425,7 +453,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "性能分析",
"msg": "不多说,不了解的不要安装!",
@@ -444,7 +473,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "异步、并行、高性能网络通信引擎",
@@ -472,7 +502,9 @@
"73",
"74",
"80",
"81"
"81",
"82",
"83"
],
"type": "框架",
"msg": "Yaf是一个C语言编写的PHP框架",
@@ -487,7 +519,12 @@
"71",
"72",
"73",
"74"
"74",
"80",
"81",
"82",
"83",
"84"
],
"type": "框架",
"msg": "PHP框架",
@@ -502,11 +539,7 @@
"71",
"72",
"73",
"74",
"80",
"81",
"82",
"83"
"74"
],
"type": "框架",
"msg": "Yar是一个RPC框架",
@@ -535,7 +568,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "Mongodb数据库连接驱动",
@@ -588,7 +622,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "日志",
"msg": "SeasLog高性能日志记录",
@@ -607,7 +642,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "用于需要多字节字符串处理的模块",
@@ -626,7 +662,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "压缩",
"msg": "压缩组件",
@@ -644,7 +681,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "压缩",
"msg": "压缩组件",
+19 -19
View File
@@ -345,14 +345,14 @@ def getLimitConf(version):
# print fileini, filefpm
data = {}
try:
rep = "upload_max_filesize\s*=\s*([0-9]+)M"
rep = r"upload_max_filesize\s*=\s*([0-9]+)M"
tmp = re.search(rep, phpini).groups()
data['max'] = tmp[0]
except:
data['max'] = '50'
try:
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
tmp = re.search(rep, phpfpm).groups()
data['maxTime'] = tmp[0]
except:
@@ -384,15 +384,15 @@ def setMaxTime(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
conf = re.sub(rep, "request_terminate_timeout = " + time + "\n", conf)
mw.writeFile(filefpm, conf)
fileini = getConf(version)
phpini = mw.readFile(fileini)
rep = "max_execution_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_execution_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_execution_time = " + time + "\n", phpini)
rep = "max_input_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_input_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_input_time = " + time + "\n", phpini)
mw.writeFile(fileini, phpini)
return mw.returnJson(True, '设置成功!')
@@ -410,9 +410,9 @@ def setMaxSize(version):
path = getConf(version)
conf = mw.readFile(path)
rep = u"\nupload_max_filesize\s*=\s*[0-9]+M"
rep = r"\nupload_max_filesize\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\nupload_max_filesize = ' + maxVal + 'M', conf)
rep = u"\npost_max_size\s*=\s*[0-9]+M"
rep = r"\npost_max_size\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\npost_max_size = ' + maxVal + 'M', conf)
mw.writeFile(path, conf)
@@ -426,23 +426,23 @@ def getFpmConfig(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
data = {}
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_children'] = tmp[0]
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['start_servers'] = tmp[0]
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['min_spare_servers'] = tmp[0]
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_spare_servers'] = tmp[0]
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
tmp = re.search(rep, conf).groups()
data['pm'] = tmp[0]
return mw.getJson(data)
@@ -463,21 +463,21 @@ def setFpmConfig(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.start_servers = " + start_servers, conf)
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.min_spare_servers = " +
min_spare_servers, conf)
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_spare_servers = " +
max_spare_servers + "\n", conf)
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
mw.writeFile(filefpm, conf)
@@ -713,7 +713,7 @@ def getDisableFunc(version):
phpini = mw.readFile(filename)
data = {}
rep = "disable_functions\s*=\s{0,1}(.*)\n"
rep = r"disable_functions\s*=\s{0,1}(.*)\n"
tmp = re.search(rep, phpini).groups()
data['disable_functions'] = tmp[0]
return mw.getJson(data)
@@ -728,7 +728,7 @@ def setDisableFunc(version):
disable_functions = args['disable_functions']
phpini = mw.readFile(filename)
rep = "disable_functions\s*=\s*.*\n"
rep = r"disable_functions\s*=\s*.*\n"
phpini = re.sub(rep, 'disable_functions = ' + disable_functions + "\n", phpini)
msg = mw.getInfo('修改PHP-{1}的禁用函数为[{2}]', (version, disable_functions,))
+1 -1
View File
@@ -5,7 +5,7 @@
"name": "php-yum",
"title": "PHP[YUM]",
"coexist": true,
"versions": ["74","80","81","82","83"],
"versions": ["74","80","81","82","83","84"],
"install_pre_inspection":true,
"tip": "soft",
"checks": "server/php-yum/VERSION",
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=8.4.x
PHP_VER=84
Install_php()
{
#------------------------ install start ------------------------------------#
yum install -y php84 php84-php-fpm
if [ "$?" == "0" ];then
mkdir -p $serverPath/php-yum/${PHP_VER}
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
yum remove -y php84 php84-php-fpm php84-*
rm -rf $serverPath/php-yum/${PHP_VER}
echo "卸载php-${version}..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
+5 -2
View File
@@ -32,6 +32,7 @@ if [ "$action" == 'install' ];then
bash ${FILE_COMMON} install ${version}
else
yum install -y php${version}-php-${extName}
yum install -y php${version}-php-pecl-${extName}
fi
# if [ "${extName}" == "mysql" ];then
@@ -48,11 +49,15 @@ if [ "$action" == 'uninstall' ];then
bash ${FILE_COMMON} uninstall ${version}
else
yum remove -y php${version}-php-${extName}
yum remove -y php${version}-php-pecl-${extName}
fi
fi
echo "yum install -y php${version}-php-${extName}"
echo "yum install -y php${version}-php-pecl-${extName}"
echo "-----------------------------------------------"
echo "yum remove -y php${version}-php-${extName}"
echo "yum remove -y php${version}-php-pecl-${extName}"
echo "systemctl restart php${version}-php-fpm"
@@ -62,5 +67,3 @@ if [ "$php_status" == "" ];then
systemctl restart php${version}-php-fpm
fi
+67 -26
View File
@@ -6,7 +6,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "数据库访问抽象模块!",
@@ -20,7 +21,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用MySQL数据库的模块!",
@@ -34,7 +36,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用MySQL数据库的模块!",
@@ -48,7 +51,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用OCI8数据库的模块!",
@@ -62,7 +66,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "数据库",
"msg": "用于使用ODBC数据库的模块!",
@@ -106,7 +111,8 @@
"74",
"80",
"81",
"82"
"82",
"83"
],
"type": "脚本解密",
"msg": "用于解密ionCube Encoder加密脚本!",
@@ -137,7 +143,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "用于加速PHP脚本!",
@@ -184,7 +191,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "用于FILE!",
@@ -198,7 +206,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "用于XML!",
@@ -212,7 +221,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "用于图像文件格式!",
@@ -226,7 +236,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "通用GD库!",
@@ -240,7 +251,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "提供国际化支持",
@@ -266,7 +278,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "强大的内容缓存器,支持集群",
@@ -280,7 +293,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "更强大的内容缓存器,支持集群",
@@ -305,7 +319,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "比GD更强大的图形库",
@@ -319,7 +334,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "调试器",
"msg": "不多说,不了解的不要安装",
@@ -333,7 +349,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "性能分析",
"msg": "不多说,不了解的不要安装!",
@@ -347,7 +364,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "异步、并行、高性能网络通信引擎",
@@ -372,7 +390,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "框架",
"msg": "Yaf是一个C语言编写的PHP框架",
@@ -386,7 +405,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "框架",
"msg": "Yar是一个RPC框架",
@@ -413,7 +433,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "Mongodb数据库连接驱动",
@@ -427,7 +448,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "缓存器",
"msg": "高性能无锁共享内存Cache",
@@ -441,7 +463,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "大数据",
"msg": "SOLR全文搜索服务",
@@ -455,7 +478,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "日志",
"msg": "SeasLog高性能日志记录",
@@ -469,7 +493,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "用于需要多字节字符串处理的模块",
@@ -484,11 +509,27 @@
"81",
"82",
"82",
"83"
"83",
"84"
],
"type": "压缩",
"msg": "压缩组件",
"shell": "zip.sh",
"check": "zip"
},
{
"name": "zstd",
"versions": [
"74",
"80",
"81",
"82",
"83",
"84"
],
"type": "压缩",
"msg": "压缩组件",
"shell": "zstd.sh",
"check": "zstd"
}
]
+26 -26
View File
@@ -101,7 +101,7 @@ def status_progress(version):
def getPhpSocket(version):
path = getFpmConfFile(version)
content = mw.readFile(path)
rep = 'listen\s*=\s*(.*)'
rep = r'listen\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -133,15 +133,15 @@ def contentReplace(content, version):
content = content.replace('{$PHP_USER}', 'nobody')
content = content.replace('{$PHP_GROUP}', 'nobody')
rep = 'listen.owner\s*=\s*(.+)\r?\n'
rep = r'listen.owner\s*=\s*(.+)\r?\n'
val = ';listen.owner = nobody\n'
content = re.sub(rep, val, content)
rep = 'listen.group\s*=\s*(.+)\r?\n'
rep = r'listen.group\s*=\s*(.+)\r?\n'
val = ';listen.group = nobody\n'
content = re.sub(rep, val, content)
rep = 'user\s*=\s*(.+)\r?\n'
rep = r'user\s*=\s*(.+)\r?\n'
val = ';user = nobody\n'
content = re.sub(rep, val, content)
@@ -157,7 +157,7 @@ def contentReplace(content, version):
def makeOpenrestyConf():
phpversions = ['00', '52', '53', '54', '55', '56',
'70', '71', '72', '73', '74', '80', '81', '82', '83']
'70', '71', '72', '73', '74', '80', '81', '82', '83','84']
sdir = mw.getServerDir()
@@ -449,7 +449,7 @@ def getPhpConf(version):
phpini = mw.readFile(getConf(version))
result = []
for g in gets:
rep = g['name'] + '\s*=\s*([0-9A-Za-z_& ~]+)(\s*;?|\r?\n)'
rep = g['name'] + r'\s*=\s*([0-9A-Za-z_& ~]+)(\s*;?|\r?\n)'
tmp = re.search(rep, phpini)
if not tmp:
continue
@@ -468,7 +468,7 @@ def submitPhpConf(version):
phpini = mw.readFile(filename)
for g in gets:
if g in args:
rep = g + '\s*=\s*(.+)\r?\n'
rep = g + r'\s*=\s*(.+)\r?\n'
val = g + ' = ' + args[g] + '\n'
phpini = re.sub(rep, val, phpini)
mw.writeFile(filename, phpini)
@@ -486,14 +486,14 @@ def getLimitConf(version):
# print fileini, filefpm
data = {}
try:
rep = "upload_max_filesize\s*=\s*([0-9]+)M"
rep = r"upload_max_filesize\s*=\s*([0-9]+)M"
tmp = re.search(rep, phpini).groups()
data['max'] = tmp[0]
except:
data['max'] = '50'
try:
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
tmp = re.search(rep, phpfpm).groups()
data['maxTime'] = tmp[0]
except:
@@ -525,15 +525,15 @@ def setMaxTime(version):
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
rep = "request_terminate_timeout\s*=\s*([0-9]+)\n"
rep = r"request_terminate_timeout\s*=\s*([0-9]+)\n"
conf = re.sub(rep, "request_terminate_timeout = " + time + "\n", conf)
mw.writeFile(filefpm, conf)
fileini = getServerDir() + "/" + version + "/etc/php.ini"
phpini = mw.readFile(fileini)
rep = "max_execution_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_execution_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_execution_time = " + time + "\n", phpini)
rep = "max_input_time\s*=\s*([0-9]+)\r?\n"
rep = r"max_input_time\s*=\s*([0-9]+)\r?\n"
phpini = re.sub(rep, "max_input_time = " + time + "\n", phpini)
mw.writeFile(fileini, phpini)
return mw.returnJson(True, '设置成功!')
@@ -551,9 +551,9 @@ def setMaxSize(version):
path = getConf(version)
conf = mw.readFile(path)
rep = u"\nupload_max_filesize\s*=\s*[0-9]+M"
rep = r"\nupload_max_filesize\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\nupload_max_filesize = ' + maxVal + 'M', conf)
rep = u"\npost_max_size\s*=\s*[0-9]+M"
rep = r"\npost_max_size\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\npost_max_size = ' + maxVal + 'M', conf)
mw.writeFile(path, conf)
@@ -571,23 +571,23 @@ def getFpmConfig(version, pool = 'www'):
filefpm = getServerDir() + '/' + version + '/etc/php-fpm.d/'+pool+'.conf'
conf = mw.readFile(filefpm)
data = {}
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_children'] = tmp[0]
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['start_servers'] = tmp[0]
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['min_spare_servers'] = tmp[0]
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
tmp = re.search(rep, conf).groups()
data['max_spare_servers'] = tmp[0]
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
tmp = re.search(rep, conf).groups()
data['pm'] = tmp[0]
return mw.getJson(data)
@@ -610,21 +610,21 @@ def setFpmConfig(version):
file = getServerDir() + '/' + version + '/etc/php-fpm.d/'+pool+'.conf'
conf = mw.readFile(file)
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_children\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.start_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.start_servers = " + start_servers, conf)
rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
rep = r"\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.min_spare_servers = " +
min_spare_servers, conf)
rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
rep = r"\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*"
conf = re.sub(rep, "\npm.max_spare_servers = " +
max_spare_servers + "\n", conf)
rep = "\s*pm\s*=\s*(\w+)\s*"
rep = r"\s*pm\s*=\s*(\w+)\s*"
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
mw.writeFile(file, conf)
@@ -883,7 +883,7 @@ def getDisableFunc(version):
phpini = mw.readFile(filename)
data = {}
rep = "disable_functions\s*=\s{0,1}(.*)\n"
rep = r"disable_functions\s*=\s{0,1}(.*)\n"
tmp = re.search(rep, phpini).groups()
data['disable_functions'] = tmp[0]
return mw.getJson(data)
@@ -898,7 +898,7 @@ def setDisableFunc(version):
disable_functions = args['disable_functions']
phpini = mw.readFile(filename)
rep = "disable_functions\s*=\s*.*\n"
rep = r"disable_functions\s*=\s*.*\n"
phpini = re.sub(rep, 'disable_functions = ' +
disable_functions + "\n", phpini)
+157
View File
@@ -0,0 +1,157 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH=$PATH:/opt/homebrew/bin
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
version=8.4
PHP_VER=84
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-${version} ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
# redat ge 8
which yum
if [ "$?" == "0" ];then
cd ${rootPath}/plugins/php/lib && /bin/bash oniguruma.sh
fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
fi
#检测文件是否损坏.
md5_file_ok=xxx
if [ -f $sourcePath/php/php-${version}.tar.xz ];then
md5_file=`sha256sum $sourcePath/php/php-${version}.tar.xz | awk '{print $1}'`
if [ "${md5_file}" != "${md5_file_ok}" ]; then
echo "PHP${version} 下载文件不完整,重新安装"
rm -rf $sourcePath/php/php-${version}.tar.xz
fi
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi
cd $sourcePath/php/php${PHP_VER}
OPTIONS='--without-iconv'
if [ $sysName == 'Darwin' ]; then
OPTIONS="${OPTIONS} --with-curl"
else
OPTIONS="${OPTIONS} --with-curl"
OPTIONS="${OPTIONS} --with-readline"
fi
argon_version=`pkg-config libargon2 --modversion`
if [ "$?" == "0" ];then
OPTIONS="${OPTIONS} --with-password-argon2"
fi
IS_64BIT=`getconf LONG_BIT`
if [ "$IS_64BIT" == "64" ];then
OPTIONS="${OPTIONS} --with-libdir=lib64"
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
ZIP_OPTION='--with-zip'
libzip_version=`pkg-config libzip --modversion`
if version_lt "$libzip_version" "0.11.0" ;then
cd ${rootPath}/plugins/php/lib && /bin/bash libzip.sh
export PKG_CONFIG_PATH=$serverPath/lib/libzip/lib/pkgconfig
ZIP_OPTION="--with-zip=$serverPath/lib/libzip"
fi
echo "$sourcePath/php/php${PHP_VER}"
if [ ! -d $serverPath/php/${PHP_VER} ];then
cd $sourcePath/php/php${PHP_VER}
./buildconf --force
./configure \
--prefix=$serverPath/php/${PHP_VER} \
--exec-prefix=$serverPath/php/${PHP_VER} \
--with-config-file-path=$serverPath/php/${PHP_VER}/etc \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir=$serverPath/lib/zlib \
$ZIP_OPTION \
--enable-mbstring \
--enable-ftp \
--enable-sockets \
--enable-simplexml \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm
make clean && make -j${cpuCore} && make install && make clean
# rm -rf $sourcePath/php/php${PHP_VER}
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
$serverPath/php/init.d/php${PHP_VER} stop
rm -rf $serverPath/php/${PHP_VER}
echo "卸载php-${version}..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
+1 -1
View File
@@ -355,7 +355,7 @@ def setPmaPort():
if not os.path.exists(file):
return mw.returnJson(False, '插件未启动!')
content = mw.readFile(file)
rep = 'listen\s*(.*);'
rep = r'listen\s*(.*);'
content = re.sub(rep, "listen " + port + ';', content)
mw.writeFile(file, content)
+2 -2
View File
@@ -5,8 +5,8 @@
"type":"运行环境",
"ps":"著名Web端MySQL管理工具",
"to_ver":["4.8.4"],
"versions":["4.4.15","4.9.10","5.2.0"],
"updates":["4.4.15","4.9.10","5.2.0"],
"versions":["4.4.15","4.9.11","5.2.1"],
"updates":["4.4.15","4.9.11","5.2.1"],
"shell":"install.sh",
"checks":"server/phpmyadmin",
"path": "server/phpmyadmin",
+6 -6
View File
@@ -116,7 +116,7 @@ def readConfigTpl():
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(\d*)?'
rep = r'port\s*=\s*(\d*)?'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -400,7 +400,7 @@ def initdUinstall():
def getMyDbPos():
file = getConf()
content = mw.readFile(file)
rep = 'datadir\s*=\s*(.*)'
rep = r'datadir\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -408,7 +408,7 @@ def getMyDbPos():
def getPgPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -422,7 +422,7 @@ def setPgPort():
port = args['port']
file = getConf()
content = mw.readFile(file)
rep = "port\s*=\s*([0-9]+)\s*\n"
rep = r"port\s*=\s*([0-9]+)\s*\n"
content = re.sub(rep, 'port = ' + port + '\n', content)
mw.writeFile(file, content)
restart()
@@ -866,7 +866,7 @@ def addDb():
if listen_ip not in ["127.0.0.1/32", "localhost", "127.0.0.1"]:
sedConf("listen_addresses", "'*'")
reg = "^[\w\.-]+$"
reg = r"^[\w\.-]+$"
if not re.match(reg, dbname):
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
@@ -1337,7 +1337,7 @@ def addMasterRepSlaveUser(version=''):
if len(password) < 1:
password = mw.md5(time.time())[0:8]
if not re.match("^[\w\.-]+$", username):
if not re.match(r"^[\w\.-]+$", username):
return mw.returnJson(False, '用户名不能带有特殊符号!')
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
if username in checks or len(username) < 1:
+2 -2
View File
@@ -4,11 +4,11 @@
"tip":"soft",
"name":"postgresql",
"type":"运行环境",
"ps":"[DEV]功能强大的开源数据库",
"ps":"功能强大的开源数据库",
"coexist": false,
"install_pre_inspection":true,
"uninstall_pre_inspection":true,
"versions":["14.4"],
"versions":["14","15","16"],
"shell":"install.sh",
"checks":"server/postgresql",
"path":"server/postgresql",
+2 -2
View File
@@ -21,12 +21,12 @@ fi
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
echo '缺少安装脚本...'
exit 0
fi
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
echo '缺少安装脚本2...'
exit 0
fi
+107
View File
@@ -0,0 +1,107 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#https://www.postgresql.org/ftp/source/
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
postgreDir=${serverPath}/source/postgresql
VERSION=14.12
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
Install_App()
{
mkdir -p ${postgreDir}
echo '正在安装脚本文件...' > $install_tmp
if id postgres &> /dev/null ;then
echo "postgres uid is `id -u postgres`"
echo "postgres shell is `grep "^postgres:" /etc/passwd |cut -d':' -f7 `"
else
groupadd postgres
useradd -g postgres postgres
fi
if [ ! -d /home/postgres ];then
mkdir -p /home/postgres
fi
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
# for stable installation
if [ "$cpuCore" -gt "1" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
fi
# ----- cpu end ------
if [ ! -f ${postgreDir}/postgresql-${VERSION}.tar.bz2 ];then
wget --no-check-certificate -O ${postgreDir}/postgresql-${VERSION}.tar.bz2 --tries=3 https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.bz2
fi
if [ ! -d ${postgreDir}/postgresql-${VERSION} ];then
cd ${postgreDir} && tar -jxvf ${postgreDir}/postgresql-${VERSION}.tar.bz2
fi
if [ ! -d $serverPath/postgresql ];then
cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql \
--with-openssl
# --with-pgport=33206
echo "cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql \
--with-openssl"
# --with-pgport=33206
make -j${cpuCore} && make install && make clean
fi
if [ -d $serverPath/postgresql ];then
echo "${VERSION}" > $serverPath/postgresql/version.pl
echo 'install successful' > $install_tmp
else
echo 'install fail' > $install_tmp
fi
}
Uninstall_App()
{
rm -rf $serverPath/postgresql
echo '卸载完成' > $install_tmp
}
action=$1
if [ "${1}" == "install" ];then
Install_App
else
Uninstall_App
fi
@@ -13,7 +13,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
postgreDir=${serverPath}/source/postgresql
VERSION=14.4
VERSION=15.7
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
+107
View File
@@ -0,0 +1,107 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#https://www.postgresql.org/ftp/source/
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
postgreDir=${serverPath}/source/postgresql
VERSION=16.3
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
Install_App()
{
mkdir -p ${postgreDir}
echo '正在安装脚本文件...' > $install_tmp
if id postgres &> /dev/null ;then
echo "postgres uid is `id -u postgres`"
echo "postgres shell is `grep "^postgres:" /etc/passwd |cut -d':' -f7 `"
else
groupadd postgres
useradd -g postgres postgres
fi
if [ ! -d /home/postgres ];then
mkdir -p /home/postgres
fi
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
# for stable installation
if [ "$cpuCore" -gt "1" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
fi
# ----- cpu end ------
if [ ! -f ${postgreDir}/postgresql-${VERSION}.tar.bz2 ];then
wget --no-check-certificate -O ${postgreDir}/postgresql-${VERSION}.tar.bz2 --tries=3 https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.bz2
fi
if [ ! -d ${postgreDir}/postgresql-${VERSION} ];then
cd ${postgreDir} && tar -jxvf ${postgreDir}/postgresql-${VERSION}.tar.bz2
fi
if [ ! -d $serverPath/postgresql ];then
cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql \
--with-openssl
# --with-pgport=33206
echo "cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql \
--with-openssl"
# --with-pgport=33206
make -j${cpuCore} && make install && make clean
fi
if [ -d $serverPath/postgresql ];then
echo "${VERSION}" > $serverPath/postgresql/version.pl
echo '安装成功'
else
echo '安装失败'
fi
}
Uninstall_App()
{
rm -rf $serverPath/postgresql
echo '卸载完成'
}
action=$1
if [ "${1}" == "install" ];then
Install_App
else
Uninstall_App
fi
+1 -1
View File
@@ -277,7 +277,7 @@ def getFtpPort():
try:
file = getServerDir() + '/etc/pure-ftpd.conf'
conf = mw.readFile(file)
rep = "\n#?\s*Bind\s+[0-9]+\.[0-9]+\.[0-9]+\.+[0-9]+,([0-9]+)"
rep = r"\n#?\s*Bind\s+[0-9]+\.[0-9]+\.[0-9]+\.+[0-9]+,([0-9]+)"
port = re.search(rep, conf).groups()[0]
except:
port = '21'
+3 -3
View File
@@ -15,9 +15,9 @@ databases 16
################################ SNAPSHOTTING #################################
save 900 1
save 300 10
save 60 10000
save 900 100
save 300 1000
save 60 1000000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
+5 -5
View File
@@ -100,7 +100,7 @@ def readConfigTpl():
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pidfile\s*(.*)'
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -220,7 +220,7 @@ def getPort():
conf = getServerDir() + '/redis.conf'
content = mw.readFile(conf)
rep = "^(" + 'port' + ')\s*([.0-9A-Za-z_& ~]+)'
rep = r"^(" + r'port' + r')\s*([.0-9A-Za-z_& ~]+)'
tmp = re.search(rep, content, re.M)
if tmp:
return tmp.groups()[1]
@@ -232,7 +232,7 @@ def getRedisCmd():
requirepass = ""
conf = getServerDir() + '/redis.conf'
content = mw.readFile(conf)
rep = "^(requirepass" + ')\s*([.0-9A-Za-z_& ~]+)'
rep = r"^(requirepass" + r')\s*([.0-9A-Za-z_& ~]+)'
tmp = re.search(rep, content, re.M)
if tmp:
requirepass = tmp.groups()[1]
@@ -482,7 +482,7 @@ def getRedisConfInfo():
result = []
for g in gets:
rep = "^(" + g['name'] + ')\s*([.0-9A-Za-z_& ~]+)'
rep = r"^(" + g['name'] + r')\s*([.0-9A-Za-z_& ~]+)'
tmp = re.search(rep, content, re.M)
if not tmp:
if g['must_show'] == 0:
@@ -512,7 +512,7 @@ def submitRedisConf():
content = mw.readFile(conf)
for g in gets:
if g in args:
rep = g + '\s*([.0-9A-Za-z_& ~]+)'
rep = g + r'\s*([.0-9A-Za-z_& ~]+)'
val = g + ' ' + args[g]
if g == 'maxmemory':
+3 -3
View File
@@ -13,9 +13,9 @@ port 6379
################################ SNAPSHOTTING #################################
save 900 1
save 300 10
save 60 10000
save 900 100
save 300 1000
save 60 1000000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
+3 -3
View File
@@ -15,9 +15,9 @@ databases 16
################################ SNAPSHOTTING #################################
save 900 1
save 300 10
save 60 10000
save 900 100
save 300 1000
save 60 1000000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
+3 -3
View File
@@ -15,9 +15,9 @@ databases 16
################################ SNAPSHOTTING #################################
save 900 1
save 300 10
save 60 10000
save 900 100
save 300 1000
save 60 1000000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
+2 -2
View File
@@ -96,7 +96,7 @@ def appAuthPwd(name):
def getLog():
conf_path = appConf()
conf = mw.readFile(conf_path)
rep = 'log file\s*=\s*(.*)'
rep = r'log file\s*=\s*(.*)'
tmp = re.search(rep, conf)
if not tmp:
return ''
@@ -106,7 +106,7 @@ def getLog():
def getLsyncdLog():
path = getServerDir() + "/lsyncd.conf"
conf = mw.readFile(path)
rep = 'logfile\s*=\s*\"(.*)\"'
rep = r'logfile\s*=\s*\"(.*)\"'
tmp = re.search(rep, conf)
if not tmp:
return ''
+1 -1
View File
@@ -117,7 +117,7 @@ def readConfigTpl():
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pidfile\s*(.*)'
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
+19 -6
View File
@@ -111,7 +111,7 @@ def status():
def mkdirAll():
content = mw.readFile(getConf())
rep = 'path\s*=\s*(.*)'
rep = r'path\s*=\s*(.*)'
p = re.compile(rep)
tmp = p.findall(content)
@@ -163,7 +163,7 @@ def initDreplace():
def checkIndexSph():
content = mw.readFile(getConf())
rep = 'path\s*=\s*(.*)'
rep = r'path\s*=\s*(.*)'
p = re.compile(rep)
tmp = p.findall(content)
for x in tmp:
@@ -250,7 +250,7 @@ def initdUinstall():
def runLog():
path = getConf()
content = mw.readFile(path)
rep = 'log\s*=\s*(.*)'
rep = r'log\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
@@ -258,7 +258,7 @@ def runLog():
def getPort():
path = getConf()
content = mw.readFile(path)
rep = 'listen\s*=\s*(.*)'
rep = r'listen\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
@@ -266,7 +266,7 @@ def getPort():
def queryLog():
path = getConf()
content = mw.readFile(path)
rep = 'query_log\s*=\s*(.*)'
rep = r'query_log\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
@@ -295,7 +295,7 @@ def sphinxConfParse():
file = getConf()
bin_dir = getServerDir()
content = mw.readFile(file)
rep = 'index\s(.*)'
rep = r'index\s(.*)'
sindex = re.findall(rep, content)
indexlen = len(sindex)
cmd = {}
@@ -423,7 +423,18 @@ def updateDelta():
return ''
def installPreInspection(version):
data = mw.execShell('arch')
if data[0].strip().startswith('aarch'):
return '不支持aarch架构'
return 'ok'
if __name__ == "__main__":
version = "3.1.1"
version_pl = getServerDir() + "/version.pl"
if os.path.exists(version_pl):
version = mw.readFile(version_pl).strip()
func = sys.argv[1]
if func == 'status':
print(status())
@@ -443,6 +454,8 @@ if __name__ == "__main__":
print(initdInstall())
elif func == 'initd_uninstall':
print(initdUinstall())
elif func == 'install_pre_inspection':
print(installPreInspection(version))
elif func == 'conf':
print(getConf())
elif func == 'config_tpl':
+1
View File
@@ -6,6 +6,7 @@
"shell": "install.sh",
"versions":["3.1.1","3.2.1","3.3.1","3.4.1","3.5.1","3.6.1","3.7.1"],
"tip": "soft",
"install_pre_inspection":true,
"checks": "server/sphinx",
"path": "server/sphinx",
"display": 1,
+2 -2
View File
@@ -257,7 +257,7 @@ def confDlistTraceLog():
confd_dir = getServerDir() + '/conf.d/' + args['name']
content = mw.readFile(confd_dir)
rep = 'stdout_logfile\s*=\s*(.*)'
rep = r'stdout_logfile\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -270,7 +270,7 @@ def confDlistErrorLog():
confd_dir = getServerDir() + '/conf.d/' + args['name']
content = mw.readFile(confd_dir)
rep = 'stderr_logfile\s*=\s*(.*)'
rep = r'stderr_logfile\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
+2
View File
@@ -12,6 +12,8 @@ install_tmp=${rootPath}/tmp/mw_install.pl
VERSION=$2
# cd /www/server/mdserver-web/plugins/swap && /bin/bash install.sh install 1.1
Install_swap()
{
if [ -d $serverPath/swap ];then
+2 -2
View File
@@ -331,7 +331,7 @@ def getGlobalConf():
def openLuaNeedRequestBody():
conf = luaConf()
content = mw.readFile(conf)
content = re.sub("lua_need_request_body (.*);",
content = re.sub(r"lua_need_request_body (.*);",
'lua_need_request_body on;', content)
mw.writeFile(conf, content)
@@ -339,7 +339,7 @@ def openLuaNeedRequestBody():
def closeLuaNeedRequestBody():
conf = luaConf()
content = mw.readFile(conf)
content = re.sub("lua_need_request_body (.*);",
content = re.sub(r"lua_need_request_body (.*);",
'lua_need_request_body off;', content)
mw.writeFile(conf, content)
+2 -2
View File
@@ -51,7 +51,7 @@ def getConf():
def getPort():
file = getConf()
content = mw.readFile(file)
rep = 'listen\s*(.*);'
rep = r'listen\s*(.*);'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -193,7 +193,7 @@ def setXhPort():
if not os.path.exists(file):
return mw.returnJson(False, '插件未启动!')
content = mw.readFile(file)
rep = 'listen\s*(.*);'
rep = r'listen\s*(.*);'
content = re.sub(rep, "listen " + port + ';', content)
mw.writeFile(file, content)
mw.restartWeb()
+6 -6
View File
@@ -75,7 +75,7 @@ def checkArgs(data, ck=[]):
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = 'pidfile\s*(.*)'
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -131,14 +131,14 @@ def getMySQLConf():
def getMySQLPort():
file = getMySQLConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getMySQLSocketFile():
file = getMySQLConf()
content = mw.readFile(file)
rep = 'socket\s*=\s*(.*)'
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
@@ -201,7 +201,7 @@ def getInstalledPhpConfDir():
return 'php-80'
def isInstalledPhp():
phpver = ["80","81","82","83","84"]
phpver = ["80","81","82","83","84","85"]
php_type = ['php-apt','php-yum', 'php'];
for pt in php_type:
@@ -438,7 +438,7 @@ def runLog():
zs_conf = zabbixServerConf()
content = mw.readFile(zs_conf)
rep = 'LogFile=\s*(.*)'
rep = r'LogFile=\s*(.*)'
tmp = re.search(rep, content)
if tmp.groups():
@@ -449,7 +449,7 @@ def zabbixAgentLog():
za_conf = zabbixAgentConf()
content = mw.readFile(za_conf)
rep = 'LogFile=\s*(.*)'
rep = r'LogFile=\s*(.*)'
tmp = re.search(rep, content)
if tmp.groups():
+6 -2
View File
@@ -9,6 +9,10 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
debian_suffix=
if [ "$SYS_ARCH" == "aarch64" ];then
debian_suffix="-arm64"
fi
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
@@ -19,9 +23,9 @@ Install_App()
mkdir -p $serverPath/source/zabbix
ZABBIX_NAME=zabbix-release_6.0-5+debian${SYS_VERSION_ID}_all.deb
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME}"
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}"
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME}
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}
fi
dpkg --configure -a
+9 -4
View File
@@ -10,19 +10,24 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
SYS_ARCH=`arch`
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
ubuntu_suffix=
if [ "$SYS_ARCH" == "aarch64" ];then
ubuntu_suffix="-arm64"
fi
# 检查是否通
# zabbix_get -s 127.0.0.1 -k agent.ping
Install_App()
{
mkdir -p $serverPath/source/zabbix
ZABBIX_NAME=zabbix-release_7.0-2+ubuntu${SYS_VERSION_ID}_all.deb
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME}"
ZABBIX_NAME=zabbix-release_6.0-5+ubuntu${SYS_VERSION_ID}_all.deb
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/ubuntu${ubuntu_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}"
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME}
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/ubuntu${ubuntu_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}
fi
# apt-get -f install
+9 -2
View File
@@ -8,8 +8,15 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
sysArch=`arch`
install_tmp=${rootPath}/tmp/mw_install.pl
debian_suffix=
if [ "$sysArch" == "aarch64" ];then
debian_suffix="-arm64"
fi
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
# 检查是否通
@@ -19,9 +26,9 @@ Install_App()
mkdir -p $serverPath/source/zabbix
ZABBIX_NAME=zabbix-release_7.0-2+debian${SYS_VERSION_ID}_all.deb
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME}"
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}"
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME}
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}
fi
# apt-get -f install
+12 -5
View File
@@ -9,8 +9,13 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
sysArch=`arch`
install_tmp=${rootPath}/tmp/mw_install.pl
ubuntu_suffix=
if [ "$sysArch" == "aarch64" ];then
ubuntu_suffix="-arm64"
fi
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
# 检查是否通
@@ -20,9 +25,9 @@ Install_App()
mkdir -p $serverPath/source/zabbix
ZABBIX_NAME=zabbix-release_7.0-2+ubuntu${SYS_VERSION_ID}_all.deb
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME}"
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu${ubuntu_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}"
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME}
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu${ubuntu_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}
fi
# apt-get -f install
@@ -31,13 +36,15 @@ Install_App()
cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME}
apt update -y
apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get
apt install -y zabbix-server-mysql
apt install -y zabbix-frontend-php zabbix-sql-scripts
apt install -y zabbix-agent
}
Uninstall_App()
{
apt remove -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get
apt remove -y zabbix-server-mysql
apt remove -y zabbix-frontend-php zabbix-sql-scripts
apt remove -y zabbix-agent
rm -rf /etc/zabbix

Some files were not shown because too many files have changed in this diff Show More