Skip to content

Commit e2a48f3

Browse files
authored
Update setup_cn.sh
1 parent 1b20ce0 commit e2a48f3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

setup_cn.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package_name="mcsmanager_linux_release.tar.gz"
2626
# Node.js version to be installed
2727
# Keep the leading "v"
2828
node_version="v20.12.2"
29+
node_version_centos7="v16.20.2"
2930

3031
# Node download base URL - primary
3132
node_download_url_base="https://nodejs.org/dist/"
@@ -480,6 +481,16 @@ detect_os_info() {
480481
cprint cyan "检测到架构: $arch"
481482
}
482483

484+
version_specific_rules() {
485+
# Default: do nothing unless a rule matches
486+
487+
if [[ "$distro" == "CentOS" && "$version" == "7" ]]; then
488+
cprint yellow "Detected CentOS 7 — overriding Node.js version."
489+
node_version="$node_version_centos7"
490+
required_node_ver="${node_version#v}"
491+
fi
492+
}
493+
483494
# Check if all required commands are available
484495
check_required_commands() {
485496
local missing=0
@@ -1341,6 +1352,8 @@ main() {
13411352
safe_run check_root "脚本必须以root身份运行"
13421353
safe_run parse_args "解析参数失败" "$@"
13431354
safe_run detect_os_info "OS检测失败"
1355+
safe_run version_specific_rules "Failed to apply distro/version specific rules"
1356+
13441357
# To be moved to a master pre check function.
13451358
safe_run resolve_node_arch "解析Node.js架构失败"
13461359

0 commit comments

Comments
 (0)