fix: exec替换进程,彻底释放stdin

This commit is contained in:
mango
2026-02-24 22:45:33 +08:00
parent f622269313
commit 2599bd2c43

View File

@@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
# DD 重装系统 - 引导脚本 # DD 重装系统 - 引导脚本
# 一键: bash <(curl -sL mjjtop.com/dd) # 一键: bash <(curl -sL mjjtop.com/dd)
# 下载脚本到本地再执行,避免管道模式 stdin 冲突 # 下载核心脚本到本地再 exec 执行,彻底释放 stdin
set -e CORE_URL="https://mjjtop.com/admin/dd-reinstall/raw/branch/main/dd-core.sh"
SCRIPT_URL="https://mjjtop.com/admin/dd-reinstall/raw/branch/main/dd-core.sh" TMP="/tmp/dd-core-$$.sh"
if command -v wget &>/dev/null; then if command -v wget &>/dev/null; then
wget --no-check-certificate -qO /tmp/dd-reinstall.sh "$SCRIPT_URL" wget --no-check-certificate -qO "$TMP" "$CORE_URL"
elif command -v curl &>/dev/null; then elif command -v curl &>/dev/null; then
curl -fsSL -o /tmp/dd-reinstall.sh "$SCRIPT_URL" curl -fsSL -o "$TMP" "$CORE_URL"
else else
echo "错误: 需要 wget 或 curl" && exit 1 echo "错误: 需要 wget 或 curl" && exit 1
fi fi
chmod +x /tmp/dd-reinstall.sh chmod +x "$TMP"
bash /tmp/dd-reinstall.sh exec bash "$TMP"