Skip to content

Commit b2d977b

Browse files
committed
refactor(driver-urls): add conditional checks for OS architecture and version
Introduce OS architecture (x64/x86) and version checks (build number) to determine the appropriate driver ISO URLs. This refinement ensures that the correct driver ISOs are selected for various Windows versions, including LTSB2016, Windows 7, and newer Windows 10/11 releases, catering to both DCH and non-DCH driver models.
1 parent bdb768f commit b2d977b

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

makexrsys.ps1

+29-9
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,37 @@ switch ($makeversion) {
127127
}
128128

129129
if ($isosd -eq $true) {
130-
if ($sysver -like "*LTSB2016*") {
130+
if ($osarch -eq "x64" -and [float]$osversion -ge 16299.0) {
131+
# DCH x64
132+
$osdrvurl = "$server/d/pxy/System/Driver/DrvCeo_Mod/Drvceo_Win10_Win11_x64_Lite.iso"
133+
} elseif ($osarch -eq "x64" -and [float]$osversion -ge 10240.0) {
134+
# noDCH x64
131135
$osdrvurl = "$server/d/pxy/System/Driver/DrvCeo_Mod/Drvceo_Win10_noDCH_x64_Lite.iso"
136+
} elseif ($osarch -eq "x64" -and [float]$osversion -ge 7600.0) {
137+
# Win7 x64
138+
$osdrvurl = "$server/d/pxy/System/Driver/DrvCeo_Mod/Drvceo_Win7x64_Lite.iso"
139+
} elseif ($osarch -eq "x86" -and [float]$osversion -ge 7600.0) {
140+
# Win7 x86
141+
$osdrvurl = "$server/d/pxy/System/Driver/DrvCeo_Mod/Drvceo_Win7x86_Lite.iso"
132142
} else {
133-
$osdrvurl = "$server/d/pxy/System/Driver/DrvCeo_Mod/Drvceo_Win10_Win11_x64_Lite.iso"
143+
Write-Error "Cannot match related driver iso."
134144
}
135145
$sysver = $sysver + "_DrvCeo"
136146
$sysvercn = $sysvercn + "_驱动总裁"
137147
}
138148

139149
# dealosdriver
140150
if ($null -eq $osdrvurl) {
141-
if ([float]$osversion -gt 19041.1) {
151+
if ($osarch -eq "x64" -and [float]$osversion -ge 19041.0) {
142152
$osdrvurl = "$server/d/pxy/System/Driver/DP/NET/NET10x64.iso"
143-
} else {
153+
} elseif ($osarch -eq "x64" -and [float]$osversion -ge 10240.0) {
144154
$osdrvurl = "$server/d/pxy/System/Driver/DP/DPWin10x64.iso"
155+
} elseif ($osarch -eq "x64" -and [float]$osversion -ge 7600.0) {
156+
$osdrvurl = "$server/d/pxy/System/Driver/DP/DPWin7x64.iso"
157+
} elseif ($osarch -eq "x86" -and [float]$osversion -ge 7600.0) {
158+
$osdrvurl = "$server/d/pxy/System/Driver/DP/DPWin7x86.iso"
159+
} else {
160+
Write-Error "Cannot match related driver iso."
145161
}
146162
$sysver = $sysver + "_Net"
147163
$sysvercn = $sysvercn + "_主板驱动"
@@ -246,12 +262,16 @@ Remove-Item -Path $isopath -ErrorAction SilentlyContinue
246262
# if ($?) {Write-Host "software pack Download Successfully!"} else {Write-Error "software pack Download Failed!"}
247263
# Remove-Item -Path ".\temp\pack.7z" -ErrorAction SilentlyContinue
248264
# Remove-Item -Path ".\mount\Windows\Setup\Set\osc\搜狗拼音输入法.exe" -ErrorAction SilentlyContinue
249-
$msedge = (Invoke-RestMethod https://github.com/Bush2021/edge_installer/raw/main/data.json).'msedge-stable-win-x64'
250-
.\bin\aria2c.exe --check-certificate=false -s16 -x16 -d .\mount\Windows\Setup\Set\osc\runtime\Edge -o "$($msedge.文件名)" "$($msedge.下载链接)"
251-
if ($?) {Write-Host "Edge Download Successfully!"} else {Write-Error "Edge Download Failed!"}
265+
if ([int]$osver -ge 10) {
266+
# add edge runtime Windows 10+
267+
$msedge = (Invoke-RestMethod https://github.com/Bush2021/edge_installer/raw/main/data.json)."msedge-stable-win-$osarch"
268+
.\bin\aria2c.exe --check-certificate=false -s16 -x16 -d .\mount\Windows\Setup\Set\osc\runtime\Edge -o "$($msedge.文件名)" "$($msedge.下载链接)"
269+
if ($?) {Write-Host "Edge Download Successfully!"} else {Write-Error "Edge Download Failed!"}
270+
}
252271
.\bin\aria2c.exe --check-certificate=false -s16 -x16 -d .\mount\Windows\Setup\Set\Run -o 安装常用工具.exe "$server/d/pxy/Xiaoran%20Studio/Tools/Tools.exe"
253272
if ($?) {Write-Host "XRSYS-Tools Download Successfully!"} else {Write-Error "XRSYS-Tools Download Failed!"}
254-
"isxrsys" > ".\mount\Windows\Setup\zjsoftonlinexrsys.txt"
273+
# add tag
274+
# "isxrsys" > ".\mount\Windows\Setup\zjsoftonlinexrsys.txt"
255275

256276
# remove preinstalled appx
257277
$preinstalled = Get-AppxProvisionedPackage -Path ".\mount"
@@ -316,7 +336,7 @@ $sysfilemd5 = Get-FileHash ".\$sysfile.esd" -Algorithm MD5 | Select-Object -Expa
316336
$sysfilesha256 = Get-FileHash ".\$sysfile.esd" -Algorithm SHA256 | Select-Object -ExpandProperty Hash
317337
@{
318338
"sys" = @{
319-
"ver" = $sysver
339+
"ver" = [string]$sysver
320340
"vercn" = $sysvercn
321341
"date" = $sysdate
322342
"datefull" = $sysdatefull

0 commit comments

Comments
 (0)