diff --git a/README.md b/README.md index 76ac08c..d03e6c7 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,14 @@ bash reinstall.sh dd --img=https://example.com/xxx.xz 支持自动配置静态 IP、扩展系统盘 +### 重启到 Alpine 救援系统(不运行重装) + +可用 ssh 连接,进行手动 DD、修改分区等操作 + +```bash +bash reinstall.sh alpine --hold=1 +``` + ## Windows 下使用 下载(链接另存为)放到同一目录 diff --git a/reinstall.sh b/reinstall.sh index b581a8c..21eea15 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -936,7 +936,7 @@ if ! is_in_windows; then fi # 整理参数 -if ! opts=$(getopt -n $0 -o "" --long debug,sleep:,iso:,image-name:,img:,ci,cloud-image -- "$@"); then +if ! opts=$(getopt -n $0 -o "" --long debug,hold:,sleep:,iso:,image-name:,img:,ci,cloud-image -- "$@"); then usage_and_exit fi @@ -952,8 +952,8 @@ while true; do cloud_image=1 shift ;; - --sleep) - sleep=$2 + --hold | --sleep) + hold=$2 shift 2 ;; --img) @@ -1083,7 +1083,7 @@ build_finalos_cmdline() { } build_extra_cmdline() { - for key in confhome sleep cloud_image kernel; do + for key in confhome hold cloud_image kernel; do value=${!key} if [ -n "$value" ]; then extra_cmdline+=" extra.$key='$value'" diff --git a/trans.sh b/trans.sh index 835a20f..2a0cb5f 100644 --- a/trans.sh +++ b/trans.sh @@ -1960,7 +1960,7 @@ printf '\nyes' | setup-sshd extract_env_from_cmdline # shellcheck disable=SC2154 -if [ "$sleep" = 1 ]; then +if [ "$hold" = 1 ]; then exit fi @@ -2015,10 +2015,13 @@ else install_redhat_ubuntu fi fi -if [ "$sleep" = 2 ]; then +if [ "$hold" = 2 ]; then exit fi -# 等几秒让 web ssh 输出全部内容 +# 让 web ssh 输出全部内容 +for i in $(seq 10); do + echo +done sleep 5 reboot