diff --git a/README.en.md b/README.en.md index ee0db79..2db7b1a 100644 --- a/README.en.md +++ b/README.en.md @@ -251,10 +251,12 @@ Use `Dism++` File menu > Open Image File, select the iso to be installed to get - Windows (Vista ~ 11) - Windows Server (2008 ~ 2025) - - Windows Server Essentials - - Windows Server (Semi) Annual Channel - - Hyper-V Server - - Azure Stack HCI + - Windows Server Essentials * + - Windows Server (Semi) Annual Channel * + - Hyper-V Server * + - Azure Stack HCI * + +\* Must specify an ISO link. #### The script will install the following drivers as needed diff --git a/README.md b/README.md index 9fe9f34..fef5043 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,6 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco ## 使用 > [!TIP] -> > 所有功能均可在 Linux / Windows 下使用。 > > Linux 下运行 `bash reinstall.sh` @@ -252,10 +251,12 @@ Windows Server 2022 SERVERDATACENTER - Windows (Vista ~ 11) - Windows Server (2008 ~ 2025) - - Windows Server Essentials - - Windows Server (Semi) Annual Channel - - Hyper-V Server - - Azure Stack HCI + - Windows Server Essentials * + - Windows Server (Semi) Annual Channel * + - Hyper-V Server * + - Azure Stack HCI * + +\* 需填写 iso 链接 #### 脚本会按需安装以下驱动 diff --git a/alpine-network.sh b/alpine-network.sh index 5b494a8..77fd384 100644 --- a/alpine-network.sh +++ b/alpine-network.sh @@ -127,11 +127,11 @@ test_internet() { # debian 没有 nslookup,因此用 ping for i in $(seq 5); do - if is_need_test_ipv4 && ping -c1 -W5 $ipv4_dns1 >/dev/null 2>&1; then + if is_need_test_ipv4 && ping -c1 -W5 -I "$ethx" "$ipv4_dns1" >/dev/null 2>&1; then echo "IPv4 has internet." ipv4_has_internet=true fi - if is_need_test_ipv6 && ping -c1 -W5 $ipv6_dns1 >/dev/null 2>&1; then + if is_need_test_ipv6 && ping -c1 -W5 -I "$ethx" "$ipv6_dns1" >/dev/null 2>&1; then echo "IPv6 has internet." ipv6_has_internet=true fi @@ -188,10 +188,10 @@ interface $ethx { id-assoc na 0 { }; EOF - dhcp6c -c /var/lib/netcfg/dhcp6c.conf "$ethx" + dhcp6c -c /var/lib/netcfg/dhcp6c.conf "$ethx" || true sleep 10 # kill-all-dhcp - kill -9 "$(cat /var/run/dhcp6c.pid)" + kill -9 "$(cat /var/run/dhcp6c.pid)" || true db_progress STEP 1 # 静态 + 检测网络提示 diff --git a/reinstall.sh b/reinstall.sh index cfb5e7a..284a996 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -12,7 +12,7 @@ export LC_ALL=C # 不要漏了最后的 $PATH,否则会找不到 windows 系统程序例如 diskpart export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH -this_script=$(realpath "$0") +this_script=$(readlink -f "$0") trap 'trap_err $LINENO $?' ERR trap_err() { @@ -1313,7 +1313,7 @@ install_pkg() { apk add $pkg ;; apt) - [ -z "$apk_updated" ] && apt update && apk_updated=1 + [ -z "$apt_updated" ] && apt update && apt_updated=1 DEBIAN_FRONTEND=noninteractive apt install -y $pkg ;; esac @@ -1576,6 +1576,7 @@ collect_netconf() { continue fi + # read -r _ _ _ _ id gateway <<<"$route" id=$(awk '{print $5}' <<<"$route") gateway=$(awk '{print $6}' <<<"$route") diff --git a/trans.sh b/trans.sh index ad089d9..8244c9b 100644 --- a/trans.sh +++ b/trans.sh @@ -489,24 +489,19 @@ is_windows() { return 1 } +# 15063 或之后才支持 rdnss is_windows_support_rdnss() { - local build_ver apk add pev for dir in /os /wim; do dll=$dir/Windows/System32/kernel32.dll if [ -f $dll ]; then build_ver="$(peres -v $dll | grep 'Product Version:' | cut -d. -f3)" echo "Windows Build Version: $build_ver" - break + apk del pev + [ "$build_ver" -ge 15063 ] && return 0 || return 1 fi done - if [ -z "$build_ver" ]; then - error_and_exit "Not found kernel32.dll" - fi - apk del pev - - # 15063 或之后才支持 rdnss - [ "$build_ver" -ge 15063 ] + error_and_exit "Not found kernel32.dll" } is_need_manual_set_dnsv6() { @@ -2826,15 +2821,16 @@ install_windows() { fi # 匹配失败 + file=/image-name error "Invalid image name: $image_name" - echo "Choose a correct image name by one of follow command and continue:" + echo "Choose a correct image name by one of follow command to continue:" while read -r line; do - echo " echo '$line' >/image-name" + echo " echo '$line' >$file" done < <(echo "$all_image_names") # sleep 直到有输入 - echo >/image-name - until [ -f /image-name ] && image_name=$(xargs $file + while ! { [ -s $file ] && image_name=$(cat $file) && [ -n "$image_name" ]; }; do sleep 1 done done diff --git a/windows-setup.bat b/windows-setup.bat index c59a5da..a909779 100644 --- a/windows-setup.bat +++ b/windows-setup.bat @@ -125,17 +125,18 @@ rem 运行 ramdisk X:\setup.exe 的话 rem vista 会找不到安装源 rem server 23h2 会无法运行 -rem 26100 新版安装程序不会创建 BIOS MBR 引导 +rem 26040 开始有新版安装程序 +rem 新版安装程序不会创建 BIOS MBR 引导 if %ForceOldSetup% EQU 1 ( set setup=Y:\sources\setup.exe ) else ( set setup=Y:\setup.exe - rem 26100 旧版安装程序不会创建 winre 分区 - rem 26100 新版安装程序会创建 winre 分区 + rem 旧版安装程序不会创建 winre 分区 + rem 新版安装程序会创建 winre 分区 rem winre 分区创建在 installer 分区前面 rem 禁止 winre 分区后,winre 储存在 C 盘,依然有效 for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber') do ( - if %%a GEQ 26100 ( + if %%a GEQ 26040 ( set ResizeRecoveryPartition=/ResizeRecoveryPartition Disable ) )