39 Star 222 Fork 51

chuanjiao10 / kasini3000

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0update_k记饭店_from_git.ps1 3.22 KB
一键复制 编辑 原始数据 按行查看 历史
chuanjiao10 提交于 2023-07-15 14:05 . 本软件开源4周年啦!
#建议保存编码为:bom头 + utf8
Set-Location $PSScriptRoot
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls13,[System.Net.SecurityProtocolType]::Tls12
$url1 = 'https://gitee.com/chuanjiao10/kasini3000.git'
$url2 = 'https://github.com/chuanjiao11/kasini3000.git'
$Private:k4tmaster = "${PSScriptRoot}/k4t_node"
$Private:k4tnode = "${PSScriptRoot}/k4t_master"
if ((Test-Path -LiteralPath $Private:k4tmaster) -or (Test-Path -LiteralPath $Private:k4tnode) )
{
Write-Error '错误:发现k4t目录,请移动走k4t,升级,再移动回。 '
exit 2
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
try
{
$null = Invoke-RestMethod -Uri 'https://gitee.com/chuanjiao10/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】gitee上的git源连接失败。退出码1'
exit 1
}
finally
{
}
Write-Verbose '正在使用gitee源更新。。。'
c:\ProgramData\kasini3000\master_script\kasini3000\git\mingw64\bin\git.exe config pull.ff only
if (Test-Path -LiteralPath 'c:\ProgramData\kasini3000\.git')
{
Set-Location 'c:\ProgramData\kasini3000\'
c:\ProgramData\kasini3000\master_script\kasini3000\git\mingw64\bin\git.exe fetch --all
c:\ProgramData\kasini3000\master_script\kasini3000\git\mingw64\bin\git.exe reset --hard origin/master
c:\ProgramData\kasini3000\master_script\kasini3000\git\mingw64\bin\git.exe pull --ff --verbose
}
else
{
Write-Error '【c:\ProgramData\kasini3000\.git】目录损坏。正在重新clone'
Set-Location $env:TEMP
if (Test-Path -LiteralPath './kasini3000')
{
Remove-Item -LiteralPath './kasini3000' -Recurse -Force -Confirm:$false
}
c:\ProgramData\kasini3000\master_script\kasini3000\git\mingw64\bin\git.exe clone $url1 --branch master --depth=1 --single-branch --verbose
Copy-Item -Path ".\kasini3000\*" -Destination 'c:\ProgramData\kasini3000\' -Force -Recurse
}
if (Test-Path -LiteralPath 'c:\Program Files\PowerShell\6\pwsh.exe')
{
}
else
{
if (Test-Path -LiteralPath 'c:\ProgramData\kasini3000\master_script\PowerShell-6.2.7-win-x64\pwsh.exe')
{
Write-Warning "警告:下列操作需要管理员权限"
mkdir 'c:\Program Files\PowerShell\6'
Copy-Item -Path "c:\ProgramData\kasini3000\master_script\PowerShell-6.2.7-win-x64\*" -Destination 'c:\Program Files\PowerShell\6\' -Force -Recurse
}
}
}
if ($IsLinux -eq $True)
{
$env:LANG = 'en_US.UTF-8'
try
{
$null = Invoke-RestMethod -Uri 'https://gitee.com/chuanjiao10/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】gitee上的git源连接失败。退出码1'
exit 1
}
finally
{
}
if (Test-Path -LiteralPath '/etc/kasini3000/.git')
{
Set-Location '/etc/kasini3000/'
/usr/bin/git pull --ff --verbose
}
else
{
Write-Error '【/etc/kasini3000/.git】目录损坏。正在重新clone'
Set-Location '/tmp'
if (Test-Path -LiteralPath './kasini3000')
{
Remove-Item -LiteralPath './kasini3000' -Recurse -Force -Confirm:$false
}
/usr/bin/git clone $url1 --branch master --depth=1 --single-branch --verbose
Copy-Item -Path "./kasini3000/*" -Destination '/etc/kasini3000/' -Force -Recurse
}
}
Set-Location $PSScriptRoot
Write-Host -ForegroundColor green '【卡死你3000】升级成功!'
exit 0
PowerShell
1
https://gitee.com/chuanjiao10/kasini3000.git
git@gitee.com:chuanjiao10/kasini3000.git
chuanjiao10
kasini3000
kasini3000
master

搜索帮助