#!/bin/bash export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH 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} gitea_path="${setup_path}/server/gitea" if [ ! -d "${gitea_path}" ]; then mkdir -p ${gitea_path} fi # 架构判断 if [ ${ARCH} == "x86_64" ]; then gitea_file="gitea-${version}-linux-amd64.7z" elif [ ${ARCH} == "aarch64" ]; then gitea_file="gitea-${version}-linux-arm64.7z" else error "Unsupported architecture" fi # 安装依赖 if [ ${OS} == "rhel" ]; then dnf makecache -y dnf install git git-lfs -y elif [ ${OS} == "debian" ] || [ ${OS} == "ubuntu" ]; then apt-get update apt-get install git git-lfs -y else error "Unsupported system" fi git lfs install git lfs version # 下载 cd ${gitea_path} dl "${gitea_path}" "/gitea/${gitea_file}" # 解压 cd ${gitea_path} 7z x ${gitea_file} rm -f ${gitea_file} mv gitea-${version}-linux-* gitea if [ ! -f "${gitea_path}/gitea" ]; then rm -rf ${gitea_path} error "Extraction failed" fi # 初始化目录 mkdir -p ${gitea_path}/{custom,data,log} chown -R www:www ${gitea_path} chmod -R 700 ${gitea_path} ln -sf ${gitea_path}/gitea /usr/local/bin/gitea # 配置systemd cat >/etc/systemd/system/gitea.service <