1 Star 0 Fork 54

LeeCarty/kasini3000

forked from chuanjiao10/kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0update_k记饭店_from_git.ps1 3.60 KB
一键复制 编辑 原始数据 按行查看 历史
#建议保存编码为: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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/leecarty/kasini3000.git
git@gitee.com:leecarty/kasini3000.git
leecarty
kasini3000
kasini3000
master

搜索帮助