1 Star 0 Fork 55

ookk/project_12773813

forked from chuanjiao10/kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0update_k记饭店_from_git.ps1 3.59 KB
一键复制 编辑 原始数据 按行查看 历史
#建议保存编码为:bom头 + utf8
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url1 = 'https://gitee.com/chuanjiao10/kasini3000.git'
$url2 = 'https://github.com/chuanjiao11/kasini3000.git'
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
Set-Location $env:TEMP
Remove-Item -LiteralPath "${env:TEMP}\kasini3000" -Recurse -Force -Confirm:$false
Start-Sleep -Seconds 3
mkdir "${env:TEMP}\kasini3000"
try
{
$null = Invoke-RestMethod -Uri 'https://gitee.com/chuanjiao10/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】gitee上的git源连接失败'
$gitee = $false
}
finally
{
}
$gitee = $True
if ($gitee -eq $True)
{
Write-Verbose '正在使用gitee源更新。。。'
Set-Location 'c:\ProgramData\kasini3000\master_script\kasini3000\git\cmd'
git.exe clone --verbose $url1 "${env:TEMP}\kasini3000"
Remove-Item -LiteralPath "${env:TEMP}\kasini3000\.git" -Recurse -Force -Confirm:$false
Copy-Item -LiteralPath "${env:TEMP}\kasini3000" -Destination 'c:\ProgramData\kasini3000' -Force -Recurse
Start-Sleep -Seconds 3
Remove-Item -LiteralPath "${env:TEMP}\kasini3000" -Recurse -Force -Confirm:$false
}
else
{
try
{
$null = Invoke-RestMethod -Uri 'https://github.com/chuanjiao11/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】github上的git源连接又失败。【卡死你3000】升级失败退出。退出码1'
exit 1
}
finally
{
}
Write-Verbose '正在使用github源更新。。。'
Set-Location 'c:\ProgramData\kasini3000\master_script\kasini3000\git\cmd'
git.exe clone --verbose $url2 "${env:TEMP}\kasini3000"
Remove-Item -LiteralPath "${env:TEMP}\kasini3000\.git" -Recurse -Force -Confirm:$false
Copy-Item -LiteralPath "${env:TEMP}\kasini3000" -Destination 'c:\ProgramData\kasini3000' -Force -Recurse
Start-Sleep -Seconds 3
Remove-Item -LiteralPath "${env:TEMP}\kasini3000" -Recurse -Force -Confirm:$false
}
}
if ($IsLinux -eq $True)
{
$env:LANG = 'en_US.UTF-8'
Set-Location /tmp
Remove-Item -LiteralPath "/tmp/kasini3000" -Recurse -Force -Confirm:$false
Start-Sleep -Seconds 3
mkdir "/tmp/kasini3000"
try
{
$null = Invoke-RestMethod -Uri 'https://gitee.com/chuanjiao10/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】gitee上的git源连接失败'
$gitee = $false
}
finally
{
}
$gitee = $True
if ($gitee -eq $True)
{
Write-Verbose '正在使用gitee源更新。。。'
/usr/bin/git clone --verbose $url1 "/tmp/kasini3000"
Remove-Item -LiteralPath "/tmp/kasini3000/.git" -Recurse -Force -Confirm:$false
Copy-Item -LiteralPath "/tmp/kasini3000" -Destination '/etc' -Force -Recurse
Start-Sleep -Seconds 3
Remove-Item -LiteralPath "/tmp/kasini3000" -Recurse -Force -Confirm:$false
}
else
{
try
{
$null = Invoke-RestMethod -Uri 'https://github.com/chuanjiao11/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】github上的git源连接又失败。【卡死你3000】升级失败退出。退出码1'
exit 1
}
finally
{
}
Write-Verbose '正在使用github源更新。。。'
/usr/bin/git clone --verbose $url2 "/tmp/kasini3000"
Remove-Item -LiteralPath "/tmp/kasini3000/.git" -Recurse -Force -Confirm:$false
Copy-Item -LiteralPath "/tmp/kasini3000" -Destination '/etc' -Force -Recurse
Start-Sleep -Seconds 3
Remove-Item -LiteralPath "/tmp/kasini3000" -Recurse -Force -Confirm:$false
}
}
Write-Host -ForegroundColor green '【卡死你3000】升级成功!'
exit 0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/gay_hub/kasini3000.git
git@gitee.com:gay_hub/kasini3000.git
gay_hub
kasini3000
project_12773813
master

搜索帮助