新增红帽系统支持

This commit is contained in:
user123
2026-01-30 18:04:48 +08:00
parent 1664faecee
commit d9e4110967
2 changed files with 25 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# OpenClaw 一键安装与管理脚本 # OpenClaw 一键安装与管理脚本
# 兼容 Debian / Ubuntu # 兼容 Debian / Ubuntu / CentOS / RHEL / Fedora / AlmaLinux / Rocky Linux / Oracle Linux
# 官方文档: https://openclaw.ai/ # 官方文档: https://openclaw.ai/
# 颜色定义 # 颜色定义
@@ -28,10 +28,21 @@ check_root() {
check_sys() { check_sys() {
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
. /etc/os-release . /etc/os-release
if [[ "$ID" != "debian" && "$ID" != "ubuntu" ]]; then case "$ID" in
echo -e "${RED}错误: 本脚本仅支持 Debian 或 Ubuntu 系统!${PLAIN}" debian|ubuntu|kali)
exit 1 PM="apt-get"
fi NODE_REPO="https://deb.nodesource.com/setup_22.x"
;;
centos|rhel|fedora|almalinux|rocky|ol)
PM="yum"
command -v dnf >/dev/null 2>&1 && PM="dnf"
NODE_REPO="https://rpm.nodesource.com/setup_22.x"
;;
*)
echo -e "${RED}错误: 本脚本不支持当前系统: $ID${PLAIN}"
exit 1
;;
esac
else else
echo -e "${RED}错误: 无法检测系统版本!${PLAIN}" echo -e "${RED}错误: 无法检测系统版本!${PLAIN}"
exit 1 exit 1
@@ -72,10 +83,13 @@ install_nodejs() {
fi fi
log_info "正在安装Node.js" log_info "正在安装Node.js"
[ -d /etc/apt/sources.list.d ] || mkdir -p /etc/apt/sources.list.d if [ "$PM" == "apt-get" ]; then
apt-get install -y curl git [ -d /etc/apt/sources.list.d ] || mkdir -p /etc/apt/sources.list.d
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - fi
apt-get install -y nodejs
$PM install -y curl git
curl -fsSL $NODE_REPO | bash -
$PM install -y nodejs
if command -v node >/dev/null 2>&1; then if command -v node >/dev/null 2>&1; then
NODE_VERSION=$(node -v) NODE_VERSION=$(node -v)
@@ -325,7 +339,7 @@ modify_config() {
# 菜单 # 菜单
show_menu() { show_menu() {
clear clear
echo -e "${CYAN}OpenClaw 管理脚本${PLAIN}" echo -e "${CYAN}OpenClaw 原ClawdBot管理脚本${PLAIN}"
echo -e "${CYAN}------------------------${PLAIN}" echo -e "${CYAN}------------------------${PLAIN}"
echo -e "1. 安装并配置 OpenClaw" echo -e "1. 安装并配置 OpenClaw"
echo -e "2. 启动服务" echo -e "2. 启动服务"

View File

@@ -458,7 +458,7 @@ modify_config() {
show_menu() { show_menu() {
clear clear
echo -e "${CYAN}OpenClaw 管理脚本${PLAIN}" echo -e "${CYAN}OpenClaw 原ClawdBot管理脚本${PLAIN}"
echo -e "${CYAN}------------------------${PLAIN}" echo -e "${CYAN}------------------------${PLAIN}"
echo -e "1. 安装并配置 OpenClaw" echo -e "1. 安装并配置 OpenClaw"
echo -e "2. 启动服务" echo -e "2. 启动服务"