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

97 lines
1.9 KiB
Bash

#!/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
channel=${1}
version=${2}
apache_path="${setup_path}/server/apache"
j=$(calculate_j)
if [ ! -d "${apache_path}" ]; then
error "Apache is not installed"
fi
# 清理旧源码
rm -rf ${apache_path}/src
# 下载新源码
dl "${apache_path}" "/apache/httpd-${version}.tar.gz"
cd ${apache_path}
tar -zxvf httpd-${version}.tar.gz
rm -f httpd-${version}.tar.gz
mv httpd-${version} src
cd src
# 下载并解压 APR
dl "${apache_path}/src/srclib" "/apache/apr-1.7.6.tar.gz"
cd ${apache_path}/src/srclib
tar -zxvf apr-1.7.6.tar.gz
rm -f apr-1.7.6.tar.gz
mv apr-1.7.6 apr
# 下载并解压 APR-Util
dl "${apache_path}/src/srclib" "/apache/apr-util-1.6.3.tar.gz"
cd ${apache_path}/src/srclib
tar -zxvf apr-util-1.6.3.tar.gz
rm -f apr-util-1.6.3.tar.gz
mv apr-util-1.6.3 apr-util
cd ${apache_path}/src
# 配置编译
./configure --prefix=${apache_path} \
--enable-mods-shared=most \
--with-included-apr \
--enable-ssl \
--enable-http2 \
--enable-proxy \
--enable-brotli \
--enable-deflate \
--enable-rewrite \
--enable-remoteip \
--enable-lua \
--enable-dav \
--enable-dav-fs \
--enable-cache \
--enable-cache-disk \
--enable-socache-shmcb \
--enable-slotmem-shm \
--enable-watchdog \
--enable-md \
--enable-systemd
if [ "$?" != "0" ]; then
error "Configure failed"
fi
make "-j${j}"
if [ "$?" != "0" ]; then
error "Compilation failed"
fi
# 停止服务
systemctl stop apache
make install
if [ ! -f "${apache_path}/bin/httpd" ]; then
systemctl start apache
error "Installation failed"
fi
# 重启服务
systemctl start apache
if [ "$?" != "0" ]; then
error "Failed to start"
fi
acepanel app write apache ${channel} ${version}
echo -e $HR
echo "Upgrade successful"
echo -e $HR