From a4fc19d2f684a2c8cd388522158713ab1e078ecd Mon Sep 17 00:00:00 2001 From: Netch Date: Tue, 20 Jul 2021 10:05:31 +0800 Subject: [PATCH] Update scripts --- Other/aiodns/build.ps1 | 4 +--- Other/aiodns/deps.ps1 | 4 +--- Other/build.ps1 | 8 +++----- Other/clean.ps1 | 8 +++----- Other/deps.ps1 | 8 +++----- Other/tap2socks/build.ps1 | 4 +--- Other/tap2socks/deps.ps1 | 4 +--- Other/tun2socks/build.ps1 | 4 +--- Other/tun2socks/deps.ps1 | 4 +--- 9 files changed, 15 insertions(+), 33 deletions(-) diff --git a/Other/aiodns/build.ps1 b/Other/aiodns/build.ps1 index c3956ade..426dd83c 100644 --- a/Other/aiodns/build.ps1 +++ b/Other/aiodns/build.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) $Env:CGO_ENABLED="0" $Env:GOROOT_FINAL="/usr" diff --git a/Other/aiodns/deps.ps1 b/Other/aiodns/deps.ps1 index 7c6e4058..40b77451 100644 --- a/Other/aiodns/deps.ps1 +++ b/Other/aiodns/deps.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) rm -Force go.* go mod init aiodns diff --git a/Other/build.ps1 b/Other/build.ps1 index 06e1c302..6ad1bde5 100644 --- a/Other/build.ps1 +++ b/Other/build.ps1 @@ -1,10 +1,8 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) .\clean.ps1 -Get-ChildItem -Path . -Directory | ForEach-Object { +Get-ChildItem -Path '.' -Directory | ForEach-Object { $name=$_.Name Write-Host "Building $name" @@ -18,7 +16,7 @@ Get-ChildItem -Path . -Directory | ForEach-Object { Write-Host -Get-ChildItem -Path .\release -File | ForEach-Object { +Get-ChildItem -Path '.\release' -File | ForEach-Object { $name=$_.Name $hash=(Get-FileHash ".\release\$name" -Algorithm SHA256).Hash.ToLower() diff --git a/Other/clean.ps1 b/Other/clean.ps1 index 9d56fc0e..d201fbb2 100644 --- a/Other/clean.ps1 +++ b/Other/clean.ps1 @@ -1,9 +1,7 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) -Push-Location $exec - -if (Test-Path release) { - Remove-Item -Recurse -Force release +if (Test-Path 'release') { + rm -Recurse -Force 'release' } Pop-Location diff --git a/Other/deps.ps1 b/Other/deps.ps1 index f2dbdeb6..b9f2e0b9 100644 --- a/Other/deps.ps1 +++ b/Other/deps.ps1 @@ -1,14 +1,12 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) .\clean.ps1 -Get-ChildItem -Path . -Directory | ForEach-Object { +Get-ChildItem -Path '.' -Directory | ForEach-Object { $name=$_.Name & ".\$name\deps.ps1" - if (-Not $?) { + if ( -Not $? ) { exit $lastExitCode } } diff --git a/Other/tap2socks/build.ps1 b/Other/tap2socks/build.ps1 index 6490124f..021dc12a 100644 --- a/Other/tap2socks/build.ps1 +++ b/Other/tap2socks/build.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) $Env:CGO_ENABLED="0" $Env:GOROOT_FINAL="/usr" diff --git a/Other/tap2socks/deps.ps1 b/Other/tap2socks/deps.ps1 index 1458b9bf..9162ef72 100644 --- a/Other/tap2socks/deps.ps1 +++ b/Other/tap2socks/deps.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) rm -Force go.* go mod init tap2socks diff --git a/Other/tun2socks/build.ps1 b/Other/tun2socks/build.ps1 index 03c74dcc..d9b44c9a 100644 --- a/Other/tun2socks/build.ps1 +++ b/Other/tun2socks/build.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) $Env:CGO_ENABLED="0" $Env:GOROOT_FINAL="/usr" diff --git a/Other/tun2socks/deps.ps1 b/Other/tun2socks/deps.ps1 index 030b4489..f65581a1 100644 --- a/Other/tun2socks/deps.ps1 +++ b/Other/tun2socks/deps.ps1 @@ -1,6 +1,4 @@ -$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent) - -Push-Location $exec +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) rm -Force go.* go mod init tun2socks