mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
core: 记录 xda 到文件
This commit is contained in:
parent
7ededb9961
commit
911ff23b07
@ -163,7 +163,7 @@ bash reinstall.sh centos 9
|
||||
> When installing Debian / Kali, x86 architectures can monitor the installation progress through VNC in the background, while ARM architectures can use the serial console.
|
||||
>
|
||||
> When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
|
||||
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `xda=drive_name /trans.sh alpine`
|
||||
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine`
|
||||
|
||||
<details>
|
||||
|
||||
@ -217,7 +217,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||
|
||||
> [!TIP]
|
||||
> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
|
||||
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `xda=drive_name /trans.sh alpine`
|
||||
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine`
|
||||
|
||||
### Feature 3: Reboot to <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Rescue System (Live OS)
|
||||
|
||||
|
@ -163,7 +163,7 @@ bash reinstall.sh centos 9
|
||||
> 安装 Debian / Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。
|
||||
>
|
||||
> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||
> <br />即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装到 Alpine。
|
||||
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
|
||||
|
||||
<details>
|
||||
|
||||
@ -217,7 +217,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||
|
||||
> [!TIP]
|
||||
> 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||
> <br />即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装到 Alpine。
|
||||
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
|
||||
|
||||
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Live OS(救援系统)
|
||||
|
||||
|
16
trans.sh
16
trans.sh
@ -284,6 +284,14 @@ get_ttys() {
|
||||
}
|
||||
|
||||
find_xda() {
|
||||
# 出错后再运行脚本,硬盘可能已经格式化,之前记录的分区表 id 无效
|
||||
# 因此找到 xda 后要保存 xda 到 /config/xda
|
||||
|
||||
# 先读取之前保存的
|
||||
if xda=$(get_config xda 2>/dev/null) && [ -n "$xda" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# 防止 $main_disk 为空
|
||||
if [ -z "$main_disk" ]; then
|
||||
error_and_exit "cmdline main_disk is empty."
|
||||
@ -316,7 +324,9 @@ find_xda() {
|
||||
xda=$(lsblk --nodeps -rno NAME,PTUUID | grep -iw "$main_disk" | awk '{print $1}')
|
||||
fi
|
||||
|
||||
if [ -z "$xda" ]; then
|
||||
if [ -n "$xda" ]; then
|
||||
set_config xda "$xda"
|
||||
else
|
||||
error_and_exit "Could not find xda: $main_disk"
|
||||
fi
|
||||
|
||||
@ -478,6 +488,10 @@ get_config() {
|
||||
cat "/configs/$1"
|
||||
}
|
||||
|
||||
set_config() {
|
||||
printf '%s' "$2" >"/configs/$1"
|
||||
}
|
||||
|
||||
get_password_linux_sha512() {
|
||||
get_config password-linux-sha512
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user