From 99b99cc7acc5d6758ced42932a5d87a02dc7b9fc Mon Sep 17 00:00:00 2001 From: Heng lu Date: Thu, 26 Feb 2026 20:01:07 +0800 Subject: [PATCH] =?UTF-8?q?"chore:=20=E4=B8=BA=20--cloud-data=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=87=E6=A1=A3=EF=BC=8C=E5=90=8C=E6=97=B6cloud-dat?= =?UTF-8?q?a=E5=B7=A5=E4=BD=9C=E6=97=B6=E5=9C=A8=20dd=20info=20output?= =?UTF-8?q?=E4=B8=AD=E6=98=BE=E7=A4=BA=20(#560)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 19 +++++++++++++++++++ README.md | 19 +++++++++++++++++++ reinstall.sh | 5 +++++ 3 files changed, 43 insertions(+) diff --git a/README.en.md b/README.en.md index d5cad59..0cb63d6 100644 --- a/README.en.md +++ b/README.en.md @@ -248,9 +248,28 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz" - `--ssh-port PORT` Change SSH port (for log observation during installation) - `--web-port PORT` Change Web port (for log observation during installation) - `--frpc-toml PATH` Add frpc for intranet tunneling (DD Windows only). Parameter can be local filepath or HTTP URL +- `--cloud-data PATH_OR_URL` Inject cloud-init NoCloud configuration into the DD'd Linux image (DD Linux only) - `--hold 1` Reboot only into install environment, without running installer, only for SSH connect to test network connection. - `--hold 2` Prevent reboot after the DD process finishes. For SSH login to modify system content. The Windows system will be mounted at `/os`, but Linux systems will **NOT** be automatically mounted. +> [!TIP] +> +> `--cloud-data` accepts a local directory path or an HTTP base URL. The directory must contain a `user-data` file; `meta-data` and `network-config` are optional: +> +> ``` +> seed/ +> ├── user-data # required +> ├── meta-data # optional +> └── network-config # optional +> ``` +> +> ```bash +> # Local directory +> bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data /path/to/seed/ +> # HTTP directory +> bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data "https://example.com/seed/" +> ``` + > [!TIP] > > Can monitor the progress through various methods (SSH, HTTP 80 port, VNC from server provider, serial console). diff --git a/README.md b/README.md index 99a0b53..e36ece5 100644 --- a/README.md +++ b/README.md @@ -248,9 +248,28 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz" - `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用) - `--web-port PORT` 修改 Web 端口(安装期间观察日志用) - `--frpc-toml PATH` 添加 frpc 内网穿透(仅限 DD Windows),参数填本地路径或 HTTP 链接 +- `--cloud-data PATH_OR_URL` 为 DD Linux 镜像注入 cloud-init NoCloud 配置(仅限 DD Linux) - `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性 - `--hold 2` DD 结束后不重启,用于 SSH 登录修改系统内容,Windows 系统会挂载在 `/os`,Linux 系统**不会**自动挂载 +> [!TIP] +> +> `--cloud-data` 参数为本地目录或 HTTP 基础 URL,目录须包含 `user-data` 文件,`meta-data`、`network-config` 可选: +> +> ``` +> seed/ +> ├── user-data # 必须 +> ├── meta-data # 可选 +> └── network-config # 可选 +> ``` +> +> ```bash +> # 使用本地目录 +> bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data /path/to/seed/ +> # 使用 HTTP 目录 +> bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data "https://example.com/seed/" +> ``` + > [!TIP] > > 可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。 diff --git a/reinstall.sh b/reinstall.sh index a3f15ea..bbd2143 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -3776,6 +3776,7 @@ This script is outdated, please download reinstall.sh again. fi # 校验:至少要有 user-data [ -f $initrd_dir/configs/cloud-data/user-data ] || error_and_exit "--cloud-data must contain user-data" + cloud_data_files=$(ls $initrd_dir/configs/cloud-data/ | tr '\n' ' ') fi if is_distro_like_debian $nextos_distro; then @@ -4692,6 +4693,10 @@ if is_netboot_xyz; then elif is_alpine_live; then echo 'Reboot to start Alpine Live OS.' elif is_use_dd; then + if [ -n "$cloud_data" ]; then + echo "Cloud Data: $cloud_data" + echo "Cloud Data Files: $cloud_data_files" + fi show_dd_password_tips echo 'Reboot to start DD.' elif [ "$distro" = fnos ]; then