1 Star 0 Fork 54

Fork Bomb/project_13384759

forked from chuanjiao10/kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0update_k记饭店_from_git.ps1 3.04 KB
一键复制 编辑 原始数据 按行查看 历史
chuanjiao10 提交于 2020-12-18 14:32 . 优化升级文件
#建议保存编码为: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:备份目录 "
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
& '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')
{
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)
{
& '/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'
}
Write-Host -ForegroundColor green '【卡死你3000】升级成功!'
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/forkbomb/kasini3000.git
[email protected]:forkbomb/kasini3000.git
forkbomb
kasini3000
project_13384759
master

搜索帮助