diff --git a/ru2 b/ru2 index 4c5e1c5..819da41 100644 --- a/ru2 +++ b/ru2 @@ -1,4 +1,4 @@ -bash <(curl -sSL https://raw.githubusercontent.com/tech-shrimp/rustdesk-native-install/main/install.sh 2>/dev/null || echo " +cat > install_native.sh << 'EOF' #!/bin/bash # 颜色定义 GREEN='\033[32m' @@ -6,35 +6,48 @@ RED='\033[31m' YELLOW='\033[33m' PLAIN='\033[0m' -# 安装目录 -INSTALL_DIR='/opt/rustdesk' -WORK_DIR='/vol1/1000/dock/rustdesk_native' # 既然没有Docker,我们用这个目录存数据以符合你的习惯 - -echo -e \"\${GREEN}>>> 开始安装 RustDesk Server (原生版) <<<\${PLAIN}\" - -# 1. 准备环境 -if [[ \$EUID -ne 0 ]]; then - echo -e \"\${RED}请使用 root 运行!\${PLAIN}\" +# 1. 基础环境准备 +if [[ $EUID -ne 0 ]]; then + echo -e "${RED}错误:请使用 root 用户运行此脚本!${PLAIN}" exit 1 fi -apt-get update && apt-get install -y wget unzip tar -# 2. 获取 IP -read -p \"请输入服务器公网 IP (必填): \" HOST_IP -if [[ -z \"\$HOST_IP\" ]]; then echo -e \"\${RED}IP 不能为空\${PLAIN}\"; exit 1; fi +echo -e "${GREEN}正在安装必要工具...${PLAIN}" +apt-get update -y && apt-get install -y wget unzip tar systemd -# 3. 下载程序 (使用 GitHub 最新稳定版) -mkdir -p \$INSTALL_DIR -mkdir -p \$WORK_DIR -cd \$INSTALL_DIR -echo -e \"\${YELLOW}正在下载 RustDesk 服务端程序...\${PLAIN}\" -# 这里使用固定的稳定版链接,防止获取失败 +# 2. 设置目录 (适配你的习惯) +INSTALL_DIR="/opt/rustdesk" +# 数据存放目录 (你的习惯路径) +DATA_DIR="/vol1/1000/dock/rustdesk_native" + +mkdir -p "$INSTALL_DIR" +mkdir -p "$DATA_DIR" + +# 3. 获取公网IP +read -p "请输入服务器公网 IP (必填): " HOST_IP +if [[ -z "$HOST_IP" ]]; then + echo -e "${RED}错误:IP 不能为空!${PLAIN}" + exit 1 +fi + +# 4. 下载并解压程序 (使用 1.1.11-1 稳定版) +echo -e "${YELLOW}正在下载 RustDesk 服务端程序...${PLAIN}" +cd "$INSTALL_DIR" +rm -rf rustdesk-server-linux-amd64.zip hbbs hbbr wget -O rustdesk-server.zip https://github.com/rustdesk/rustdesk-server/releases/download/1.1.11-1/rustdesk-server-linux-amd64.zip + +if [ ! -f "rustdesk-server.zip" ]; then + echo -e "${RED}下载失败,请检查网络连接。${PLAIN}" + exit 1 +fi + unzip -o rustdesk-server.zip chmod +x hbbs hbbr -# 4. 创建系统服务 (hbbs - ID服务器) -cat > /etc/systemd/system/rustdesk-hbbs.service < /etc/systemd/system/rustdesk-hbbs.service < /etc/systemd/system/rustdesk-hbbr.service < /etc/systemd/system/rustdesk-hbbr.service <