重构脚本:重命名 root-setup 为 wsl-init 并修复关键问题
- 重命名 root-setup.sh 为 wsl-init.sh,明确 WSL 专属 - 添加 WSL 环境检查,防止在非 WSL 环境误执行 - 添加 sudoers 配置,修复 install.sh 无法使用 sudo 的问题 - 去掉 wsl-init 中的 -Syu,避免重复升级 - 备份已有 /etc/wsl.conf 再覆盖 - install.sh 克隆逻辑改为安全检测,避免误删已有仓库 - README 区分 WSL 首次启动和普通 Arch 两条路径
This commit is contained in:
@@ -1,36 +1,45 @@
|
||||
# Arch Linux 配置仓库
|
||||
|
||||
使用 dcli 声明式管理 Arch Linux 配置(当前默认主机为 wsl,可扩展到其他主机)。
|
||||
使用 dcli 声明式管理 Arch Linux 配置。
|
||||
当前默认主机为 `wsl`;非 WSL 环境请先新增/切换 host,再执行同步。
|
||||
|
||||
## 快速开始
|
||||
## 使用方式
|
||||
|
||||
### 1. 初始化用户(以 root 身份,仅 WSL 首次)
|
||||
### A. Arch on WSL 首次启动(默认 root 登录)
|
||||
|
||||
1. 初始化普通用户:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.furtherverse.com/imbytecat/archlinux-config/raw/branch/main/scripts/root-setup.sh | bash -s -- <用户名>
|
||||
curl -fsSL https://git.furtherverse.com/imbytecat/archlinux-config/raw/branch/main/scripts/wsl-init.sh | bash -s -- <用户名>
|
||||
```
|
||||
|
||||
然后在 PowerShell 中重启 WSL:
|
||||
2. 在 PowerShell 中重启 WSL:
|
||||
|
||||
```powershell
|
||||
wsl --terminate archlinux
|
||||
```
|
||||
|
||||
### 2. 安装配置(以普通用户身份)
|
||||
3. 重新进入 Arch WSL 后,以普通用户执行:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.furtherverse.com/imbytecat/archlinux-config/raw/branch/main/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
### 3. 应用配置
|
||||
|
||||
```bash
|
||||
dcli sync
|
||||
```
|
||||
|
||||
### B. 普通 Arch 安装(已存在普通用户)
|
||||
|
||||
跳过 WSL 初始化,直接执行:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.furtherverse.com/imbytecat/archlinux-config/raw/branch/main/scripts/install.sh | bash
|
||||
dcli sync
|
||||
```
|
||||
|
||||
> 注意:当前 `config.yaml` 的 `active_host` 是 `wsl`。非 WSL 环境请先新增对应 `hosts/*.yaml` 并切换 `active_host`。
|
||||
|
||||
## 配置说明
|
||||
|
||||
- `hosts/wsl.yaml` - WSL 配置
|
||||
- `hosts/` - 主机配置
|
||||
- `modules/` - 模块化包管理
|
||||
- `files/` - 配置文件(自动同步)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user