代码拉取完成,页面将自动刷新
同步操作将从 chuanjiao10/kasini3000 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#建议保存编码为:bom头 + utf8
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url1 = 'https://gitee.com/chuanjiao10/kasini3000.git'
$url2 = 'https://github.com/chuanjiao11/kasini3000.git'
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Warning "正在备份 卡死你3000 数据库,到 $global:备份目录 "
}
else
{
Write-Warning "Back up kaiiit's Hotel database to $global:备份目录 "
}
$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
{
$global:db_backup_folder = $global:备份目录 = "$env:USERPROFILE\Documents"
& 'c:\ProgramData\kasini3000\cmdb\bf当前库2备份库.ps1'
& 'c:\ProgramData\kasini3000\bf备份nodelist.ps1'
try
{
$null = Invoke-RestMethod -Uri 'https://gitee.com/chuanjiao10/' -TimeoutSec 10
}
catch
{
Write-Error '【卡死你3000】gitee上的git源连接失败。退出码1'
exit 1
}
finally
{
}
Write-Verbose '正在使用gitee源更新。。。'
if (Test-Path -LiteralPath 'c:\ProgramData\kasini3000\.git')
{
Set-Location 'c:\ProgramData\kasini3000\'
& 'c:\ProgramData\kasini3000\master_script\kasini3000\git\cmd\git.exe' pull
}
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\cmd\git.exe' clone --verbose $url1
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
}
}
& 'c:\ProgramData\kasini3000\hf恢复nodelist.ps1'
& 'c:\ProgramData\kasini3000\cmdb\hf恢复用户库.ps1'
}
if ($IsLinux -eq $True)
{
$global:db_backup_folder = $global:备份目录 = "/tmp"
$env:LANG = 'en_US.UTF-8'
& '/etc/kasini3000/cmdb/bf当前库2备份库.ps1'
& '/etc/kasini3000/bf备份nodelist.ps1'
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
}
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 --verbose $url1
Copy-Item -Path "./kasini3000/*" -Destination '/etc/kasini3000/' -Force -Recurse
}
& '/etc/kasini3000/hf恢复nodelist.ps1'
& '/etc/kasini3000/cmdb/hf恢复用户库.ps1'
}
Set-Location 'c:\ProgramData\kasini3000'
Write-Host -ForegroundColor green '【卡死你3000】升级成功!'
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。