feat: 清理提交
All checks were successful
Generate Checksums / checksums (push) Successful in 46s

This commit is contained in:
2026-01-31 07:03:45 +08:00
commit 758e1c8799
487 changed files with 8839 additions and 0 deletions

95
nodejs/install.sh Normal file
View File

@@ -0,0 +1,95 @@
#!/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
slug=${1}
version=${2}
node_path="${setup_path}/server/nodejs/${slug}"
in_china=$(curl --retry 2 -m 10 -L -k https://www.qualcomm.cn/cdn-cgi/trace 2>/dev/null | grep -qx 'loc=CN' && echo "true" || echo "false")
# 架构映射
case ${ARCH} in
x86_64)
NODE_ARCH="x64"
;;
aarch64)
NODE_ARCH="arm64"
;;
esac
# 准备安装目录
rm -rf ${node_path}
mkdir -p ${node_path}
cd ${node_path}
# 下载Node.js安装包
NODE_TARBALL="node-v${version}-linux-${NODE_ARCH}.tar.xz"
if ${in_china}; then
# 阿里云镜像站不知道是不是抽风了2025年5月底之后就没更新了改用腾讯镜像站
NODE_URL="https://mirrors.tencent.com/nodejs-release/v${version}/${NODE_TARBALL}"
echo "Downloading ${NODE_TARBALL} from Tencent mirror..."
else
NODE_URL="https://nodejs.org/dist/v${version}/${NODE_TARBALL}"
echo "Downloading ${NODE_TARBALL} from nodejs.org..."
fi
aria2c -x8 \
-U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36" \
-o ${NODE_TARBALL} \
${NODE_URL}
if [ $? -ne 0 ]; then
rm -rf ${node_path}
error "Failed to download Node.js ${version}"
fi
# 解压
tar -xJf ${NODE_TARBALL}
if [ $? -ne 0 ]; then
rm -rf ${node_path}
error "Failed to extract Node.js ${version}"
fi
# Node.js解压后会在node-v{version}-linux-{arch}目录下,移动到当前目录
mv node-v${version}-linux-${NODE_ARCH}/* .
rmdir node-v${version}-linux-${NODE_ARCH}
rm -f ${NODE_TARBALL}
# 验证安装
if [ ! -f "${node_path}/bin/node" ]; then
rm -rf ${node_path}
error "Node.js ${version} installation failed"
fi
# 设置软链接
ln -sf ${node_path}/bin/corepack /usr/local/bin/corepack${slug}
ln -sf ${node_path}/bin/node /usr/local/bin/node${slug}
ln -sf ${node_path}/bin/npm /usr/local/bin/npm${slug}
ln -sf ${node_path}/bin/npx /usr/local/bin/npx${slug}
[ ! -f /usr/local/bin/corepack ] && ln -sf ${node_path}/bin/corepack /usr/local/bin/corepack
[ ! -f /usr/local/bin/node ] && ln -sf ${node_path}/bin/node /usr/local/bin/node
[ ! -f /usr/local/bin/npm ] && ln -sf ${node_path}/bin/npm /usr/local/bin/npm
[ ! -f /usr/local/bin/npx ] && ln -sf ${node_path}/bin/npx /usr/local/bin/npx
# 国内设置npm镜像
if ${in_china}; then
${node_path}/bin/npm config set --global registry https://registry.npmmirror.com
fi
# 创建环境变量配置
cat >${node_path}/env.sh <<EOF
export NODE_HOME=${node_path}
export PATH=\$NODE_HOME/bin:\$PATH
EOF
chmod 644 ${node_path}/env.sh
echo -e $HR
echo "Node.js ${version} installation successful"
echo "Node.js path: ${node_path}"
echo "To use this version, run: source ${node_path}/env.sh"
echo -e $HR

1
nodejs/install.sh.sha256 Normal file
View File

@@ -0,0 +1 @@
90fc65f3b60d8a6db940bb187c21193ba74434fd584b70d906950308c0e1725c *install.sh

38
nodejs/uninstall.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/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
slug=${1}
node_path="${setup_path}/server/nodejs/${slug}"
rm -rf ${node_path}
rm -f /usr/local/bin/corepack${slug}
rm -f /usr/local/bin/node${slug}
rm -f /usr/local/bin/npm${slug}
rm -f /usr/local/bin/npx${slug}
if [ -L /usr/local/bin/corepack ]; then
link_path=$(readlink /usr/local/bin/corepack)
[ "${link_path}" == "${node_path}/bin/corepack" ] && rm -f /usr/local/bin/corepack
fi
if [ -L /usr/local/bin/node ]; then
link_path=$(readlink /usr/local/bin/node)
[ "${link_path}" == "${node_path}/bin/node" ] && rm -f /usr/local/bin/node
fi
if [ -L /usr/local/bin/npm ]; then
link_path=$(readlink /usr/local/bin/npm)
[ "${link_path}" == "${node_path}/bin/npm" ] && rm -f /usr/local/bin/npm
fi
if [ -L /usr/local/bin/npx ]; then
link_path=$(readlink /usr/local/bin/npx)
[ "${link_path}" == "${node_path}/bin/npx" ] && rm -f /usr/local/bin/npx
fi
echo -e $HR
echo "Uninstall successful"
echo -e $HR

View File

@@ -0,0 +1 @@
926014c5d53f49eabf5c4e5a3249c8a6af3e1d2b174a3d9dbebf6f937417ae94 *uninstall.sh

73
nodejs/update.sh Normal file
View File

@@ -0,0 +1,73 @@
#!/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
slug=${1}
version=${2}
node_path="${setup_path}/server/nodejs/${slug}"
in_china=$(curl --retry 2 -m 10 -L -k https://www.qualcomm.cn/cdn-cgi/trace 2>/dev/null | grep -qx 'loc=CN' && echo "true" || echo "false")
# 预检查
if [ ! -f "${node_path}/bin/node" ]; then
error "Node.js ${slug} is not installed"
fi
# 架构映射
case ${ARCH} in
x86_64)
NODE_ARCH="x64"
;;
aarch64)
NODE_ARCH="arm64"
;;
esac
# 下载Node.js安装包
NODE_TARBALL="node-v${version}-linux-${NODE_ARCH}.tar.xz"
if ${in_china}; then
NODE_URL="https://mirrors.cloud.tencent.com/nodejs-release/v${version}/${NODE_TARBALL}"
echo "Downloading ${NODE_TARBALL} from Tencent mirror..."
else
NODE_URL="https://nodejs.org/dist/v${version}/${NODE_TARBALL}"
echo "Downloading ${NODE_TARBALL} from nodejs.org..."
fi
cd ${node_path}
aria2c -x8 \
-U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36" \
-o ${NODE_TARBALL} \
${NODE_URL}
if [ $? -ne 0 ]; then
rm -f ${NODE_TARBALL}
error "Failed to download Node.js ${version}"
fi
# 删除旧文件
find ${node_path} -mindepth 1 ! -name "${NODE_TARBALL}" -exec rm -rf {} + 2>/dev/null
# 解压
tar -xJf ${NODE_TARBALL}
if [ $? -ne 0 ]; then
rm -f ${NODE_TARBALL}
error "Failed to extract Node.js ${version}"
fi
# Node.js解压后移动到当前目录
mv node-v${version}-linux-${NODE_ARCH}/* .
rm -rf node-v${version}-linux-${NODE_ARCH}
rm -f ${NODE_TARBALL}
# 验证安装
if [ ! -f "${node_path}/bin/node" ]; then
error "Node.js ${version} upgrade failed"
fi
echo -e $HR
echo "Upgrade successful"
echo -e $HR

1
nodejs/update.sh.sha256 Normal file
View File

@@ -0,0 +1 @@
2d707f54050dcae59ccd82497d51e47db49a4cccd93feb29f70a0a7ebbe3d7c4 *update.sh