Update scripts and fix build

This commit is contained in:
Netch
2021-07-16 06:00:50 +08:00
parent df76db1f07
commit 4f07cf20bf
24 changed files with 189 additions and 87 deletions

View File

@@ -0,0 +1,14 @@
$name="data.zip"
$address="https://github.com/netchx/netch-data/archive/refs/heads/main.zip"
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
..\scripts\extract.ps1 $name "bin"
if (-Not $?) { exit $lastExitCode }
Copy-Item -Recurse -Force .\netch-data-main\* .\bin
Remove-Item -Force $name
Remove-Item -Recurse -Force netch-data-main
exit 0

View File

@@ -0,0 +1,14 @@
$name="i18n.zip"
$address="https://github.com/netchx/netch-i18n/archive/refs/heads/main.zip"
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
..\scripts\extract.ps1 $name "i18n"
if (-Not $?) { exit $lastExitCode }
Copy-Item -Recurse -Force .\netch-i18n-main\* .\i18n
Remove-Item -Force $name
Remove-Item -Recurse -Force netch-i18n-main
exit 0

View File

@@ -0,0 +1,14 @@
$name="mode.zip"
$address="https://github.com/netchx/netch-mode/archive/refs/heads/main.zip"
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
..\scripts\extract.ps1 $name "mode"
if (-Not $?) { exit $lastExitCode }
Copy-Item -Recurse -Force .\netch-mode-main\* .\mode
Remove-Item -Force $name
Remove-Item -Recurse -Force netch-mode-main
exit 0

View File

@@ -2,7 +2,8 @@ param([string]$OutputPath)
$name="ck-client.exe"
$address="https://github.com/cbeuw/Cloak/releases/download/v2.5.4/ck-client-windows-amd64-v2.5.4.exe"
Invoke-WebRequest -Uri $address -OutFile $name
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
Move-Item -Force $name $OutputPath
exit 0

View File

@@ -2,7 +2,8 @@ param([string]$OutputPath)
$name="geoip.dat"
$address="https://github.com/v2fly/geoip/releases/download/202107080024/geoip.dat"
Invoke-WebRequest -Uri $address -OutFile $name
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
Move-Item -Force $name $OutputPath
exit 0

View File

@@ -2,7 +2,8 @@ param([string]$OutputPath)
$name="geosite.dat"
$address="https://github.com/v2fly/domain-list-community/releases/download/20210709152606/dlc.dat"
Invoke-WebRequest -Uri $address -OutFile $name
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
Move-Item -Force $name $OutputPath
exit 0

View File

@@ -1,8 +1,12 @@
param([string]$OutputPath)
$name="v2ray-core.zip"
$address="https://github.com/v2fly/v2ray-core/releases/download/v4.40.1/v2ray-windows-64.zip"
Invoke-WebRequest -Uri $address -OutFile v2ray-core.zip
Expand-Archive -Force -Path v2ray-core.zip -DestinationPath v2ray-core
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
..\scripts\extract.ps1 $name "v2ray-core"
if (-Not $?) { exit $lastExitCode }
Move-Item -Force v2ray-core\v2ctl.exe $OutputPath
Move-Item -Force v2ray-core\v2ray.exe $OutputPath

View File

@@ -0,0 +1,15 @@
param([string]$OutputPath)
$name="xray-core.zip"
$address="https://github.com/XTLS/Xray-core/releases/download/v1.4.2/Xray-windows-64.zip"
..\scripts\download.ps1 $name $address
if (-Not $?) { exit $lastExitCode }
..\scripts\extract.ps1 $name "xray-core"
if (-Not $?) { exit $lastExitCode }
Move-Item -Force "xray-core\xray.exe" $OutputPath
Remove-Item -Recurse -Force xray-core
Remove-Item -Recurse -Force xray-core.zip
exit 0

View File

@@ -1,42 +1,18 @@
param([string]$OutputPath)
param (
[string]
$name,
$NetchDataURL="https://github.com/netchx/netch-data/archive/refs/heads/main.zip"
$NetchModeURL="https://github.com/netchx/netch-mode/archive/refs/heads/main.zip"
$NetchI18NURL="https://github.com/netchx/netch-i18n/archive/refs/heads/main.zip"
[string]
$address
)
$last=(Get-Location).Path
New-Item -ItemType Directory -Name $OutputPath | Out-Null
Set-Location $OutputPath
try
{
Invoke-WebRequest -OutFile $name -Uri $address
}
catch
{
exit 1
}
Invoke-WebRequest -Uri $NetchDataURL -OutFile data.zip
Invoke-WebRequest -Uri $NetchModeURL -OutFile mode.zip
Invoke-WebRequest -Uri $NetchI18NURL -OutFile i18n.zip
Expand-Archive -Force -Path data.zip -DestinationPath .
Expand-Archive -Force -Path mode.zip -DestinationPath .
Expand-Archive -Force -Path i18n.zip -DestinationPath .
New-Item -ItemType Directory -Name Bin | Out-Null
New-Item -ItemType Directory -Name Mode | Out-Null
New-Item -ItemType Directory -Name I18N | Out-Null
Copy-Item -Recurse -Force .\netch-data-main\* .\Bin
Copy-Item -Recurse -Force .\netch-mode-main\mode\* .\Mode
Copy-Item -Recurse -Force .\netch-i18n-main\i18n\* .\I18N
Remove-Item -Recurse -Force netch-data-main
Remove-Item -Recurse -Force netch-mode-main
Remove-Item -Recurse -Force netch-i18n-main
Remove-Item -Force data.zip
Remove-Item -Force mode.zip
Remove-Item -Force i18n.zip
..\scripts\download\cloak.ps1 -OutputPath Bin
..\scripts\download\geoip.ps1 -OutputPath Bin
..\scripts\download\geosite.ps1 -OutputPath Bin
..\scripts\download\v2ray-core.ps1 -OutputPath Bin
..\scripts\download\x2ray-core.ps1 -OutputPath Bin
Get-Item *
Set-Location $last
exit 0
exit 0

View File

@@ -1,11 +0,0 @@
param([string]$OutputPath)
$address="https://github.com/XTLS/Xray-core/releases/download/v1.4.2/Xray-windows-64.zip"
Invoke-WebRequest -Uri $address -OutFile xray-core.zip
Expand-Archive -Force -Path xray-core.zip -DestinationPath xray-core
Move-Item -Force xray-core\xray.exe $OutputPath
Remove-Item -Recurse -Force xray-core
Remove-Item -Recurse -Force xray-core.zip
exit 0

19
scripts/extract.ps1 Normal file
View File

@@ -0,0 +1,19 @@
param (
[string]
$name,
[string]
$address
)
try
{
Expand-Archive -Force -Path $name -DestinationPath $address
}
catch
{
Write-Host "Extract $name failed"
exit 1
}
exit 0