不重要的优化

This commit is contained in:
bin456789 2024-06-14 23:41:15 +08:00
parent a4d65cb737
commit c682835af6
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
6 changed files with 33 additions and 32 deletions

View File

@ -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

View File

@ -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 链接
#### 脚本会按需安装以下驱动

View File

@ -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
# 静态 + 检测网络提示

View File

@ -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")

View File

@ -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 </image-name) && [ -n "$image_name" ]; do
true >$file
while ! { [ -s $file ] && image_name=$(cat $file) && [ -n "$image_name" ]; }; do
sleep 1
done
done

View File

@ -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
)
)