Files
download/mysql/prebuilt.sh
耗子 758e1c8799
All checks were successful
Generate Checksums / checksums (push) Successful in 46s
feat: 清理提交
2026-01-31 07:03:45 +08:00

71 lines
3.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
if [ $? -ne 0 ]; then
echo "Download public.sh failed, please check the network or try again later."
exit 1
fi
name=${1}
channel=${2}
version=${3}
action=${4:-install} # install 或 update
mysql_path="${setup_path}/server/mysql"
# 安装依赖
if [ ${OS} == "rhel" ]; then
dnf makecache -y
dnf groupinstall "Development Tools" -y
dnf install -y cmake ninja-build doxygen graphviz bison ncurses-devel libtirpc-devel openssl-devel pkg-config systemd-devel openldap-devel libudev-devel cyrus-sasl-devel cyrus-sasl-scram patchelf rpcgen rpcsvc-proto-devel krb5-devel zlib-devel bzip2-devel lz4-devel xz-devel readline-devel protobuf-compiler libcurl-devel libxml2-devel pcre2-devel libaio libaio-devel libatomic
# x86_64 安装 libquadmath-devel
if [ "${ARCH}" == "x86_64" ]; then
dnf install libquadmath-devel -y
fi
elif [ ${OS} == "debian" ] || [ ${OS} == "ubuntu" ]; then
apt-get update
# Debian 13+ 及 Ubuntu 25+ 需要单独安装 systemd-dev旧版系统不能安装否则会出现严重问题
if { [ ${OS} == "debian" ] && [ ${VERSION} -ge 13 ]; } || { [ ${OS} == "ubuntu" ] && [ ${VERSION} -ge 25 ]; }; then
apt-get install systemd-dev -y
fi
# Debian 13+ 及 Ubuntu 24+ 需要单独安装 libaio1t64其他系统安装 libaio1 即可
# https://activemq.apache.org/components/artemis/documentation/latest/libaio.html#runtime-dependencies
if { [ ${OS} == "debian" ] && [ ${VERSION} -ge 13 ]; } || { [ ${OS} == "ubuntu" ] && [ ${VERSION} -ge 24 ]; }; then
apt-get install libaio1t64 -y
ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
else
apt-get install libaio1 -y
fi
# x86_64 安装 libquadmath0
if [ "${ARCH}" == "x86_64" ]; then
apt-get install libquadmath0 -y
fi
apt-get install -y build-essential cmake ninja-build doxygen graphviz bison libncurses5-dev libtirpc-dev libssl-dev pkg-config libsystemd-dev libldap2-dev libudev-dev libsasl2-dev libsasl2-modules-gssapi-mit patchelf libkrb5-dev zlib1g-dev libbz2-dev liblz4-dev liblzma-dev libreadline-dev protobuf-compiler libcurl4-openssl-dev libxml2-dev libpcre2-dev libaio-dev libatomic1
else
error "Unsupported operating system"
fi
if [ "$?" != "0" ]; then
error "Failed to install dependencies"
fi
mysql_user_check=$(cat /etc/passwd | grep mysql)
if [ "${mysql_user_check}" == "" ]; then
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
fi
# 准备目录
[[ ${action} == "install" ]] && rm -rf ${mysql_path}
[[ ${action} == "install" ]] && mkdir -p ${mysql_path}
cd ${mysql_path}
# 下载源码
dl "${mysql_path}" "/mysql/prebuilt/${name}-${version}-${OS}${VERSION}-${ARCH}.tar.7z"
7z x ${name}-${version}-${OS}${VERSION}-${ARCH}.tar.7z
tar -xvf ${name}-${version}.tar
if [ "$?" != "0" ]; then
error "Failed to extract MySQL prebuilt package"
fi
rm -f ${name}-${version}-${OS}${VERSION}-${ARCH}.tar.7z
rm -f ${name}-${version}.tar