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

55 lines
1.3 KiB
Bash

#!/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}
code_server_path="${setup_path}/server/code-server"
if [ ! -d "${code_server_path}" ]; then
mkdir -p ${code_server_path}
fi
# 架构判断
if [ ${ARCH} == "x86_64" ]; then
code_server_file="code-server-${version}-linux-amd64.7z"
elif [ ${ARCH} == "aarch64" ]; then
code_server_file="code-server-${version}-linux-arm64.7z"
else
error "Unsupported architecture"
fi
# 下载
systemctl stop code-server
cd ${code_server_path}
rm -rf ${code_server_path}/*
dl "${code_server_path}" "/code-server/${code_server_file}"
# 解压
cd ${code_server_path}
7z x ${code_server_file}
rm -f ${code_server_file}
if [ ! -f "${code_server_path}/bin/code-server" ]; then
rm -rf ${code_server_path}
error "code-server extraction failed"
fi
# 初始化目录
chown -R root:root ${code_server_path}
chmod -R 700 ${code_server_path}
systemctl start code-server
if [ "$?" != "0" ]; then
error "Failed to start"
fi
acepanel app write codeserver ${channel} ${version}
echo -e $HR
echo "Upgrade successful"
echo -e $HR