This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
WebUIOneKeyScript.ps1
122 lines (114 loc) · 4.79 KB
/
WebUIOneKeyScript.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
$ErrorActionPreference = "inquire"
Write-Output "
注意:执行操作前请确认本脚本与[插件版]yobot**内层**目录或[源码版]yobot目录位于同级目录!
本脚本当前执行位置:$PSScriptRoot
===============命令菜单==================
1.为yobot[v3.6.4-rc.1]安装
2.为yobot[v3.6.4-rc.2]安装
3.卸载并恢复
4.更新
警告:若之前没有通过本脚本安装,请勿执行卸载命令!
========================================"
$choice = Read-Host "请选择要执行的操作(请输入数字序号)"
switch ($choice)
{
1
{
if (Test-Path .\YobotWebInterface)
{
Write-Output "已经有本项目文件夹了,建议去更新"
break
}
git clone https://github.com/laipz8200/YobotWebInterface.git
if (!$?)
{
Write-Output "你没装git!/ 你网络不好!"
break
}
New-Item .\yobot\src\client\public\backup -ItemType Directory
Copy-Item .\yobot\src\client\public\static .\yobot\src\client\public\backup -Recurse -Force
Copy-Item .\yobot\src\client\public\template .\yobot\src\client\public\backup -Recurse -Force
Remove-Item .\yobot\src\client\public\static -Force -Recurse
Remove-Item .\yobot\src\client\public\template -Force -Recurse
Copy-Item .\YobotWebInterface\static .\yobot\src\client\public
Copy-Item .\YobotWebInterface\template .\yobot\src\client\public
Write-Output "安装完成!"
exit
}
2
{
if (Test-Path .\YobotWebInterface)
{
Write-Output "已经有本项目文件夹了,建议去更新"
break
}
git clone https://github.com/laipz8200/YobotWebInterface.git
if (!$?)
{
Write-Output "你没装git!/ 你网络不好!"
break
}
New-Item .\yobot\src\client\public\backup -ItemType Directory
Copy-Item .\yobot\src\client\public\static .\yobot\src\client\public\backup -Recurse -Force
Copy-Item .\yobot\src\client\public\template .\yobot\src\client\public\backup -Recurse -Force
Remove-Item .\yobot\src\client\public\static -Force -Recurse
Remove-Item .\yobot\src\client\public\template -Force -Recurse
Copy-Item .\YobotWebInterface\static .\yobot\src\client\public
Copy-Item .\YobotWebInterface\template .\yobot\src\client\public
Copy-Item .\yobot\src\client\public\template\user-info-rc2.html .\yobot\src\client\public\template\user-info.html -Force
Write-Output "安装完成!"
exit
}
3
{
Remove-Item .\yobot\src\client\public\static -Force -Recurse
Remove-Item .\yobot\src\client\public\template -Force -Recurse
Copy-Item .\yobot\src\client\public\backup\static .\yobot\src\client\public
Copy-Item .\yobot\src\client\public\backup\template .\yobot\src\client\public
Remove-Item .\yobot\src\client\public\backup -Recurse -Force
Write-Output "卸载完成!"
exit
}
4
{
if(Test-Path .\YobotWebInterface)
{
Set-Location .\YobotWebInterface
git pull
if (!$?)
{
Write-Output "你没装git!/ 你网络不好!"
break
}
Set-Location ..\
if(Test-Path .\yobot\src\client\public\backup)
{
Remove-Item .\yobot\src\client\public\backup -Force -Recurse
New-Item .\yobot\src\client\public\backup -ItemType Directory
Copy-Item .\yobot\src\client\public\static .\yobot\src\client\public\backup -Recurse -Force
Copy-Item .\yobot\src\client\public\template .\yobot\src\client\public\backup -Recurse -Force
}
else {
New-Item .\yobot\src\client\public\backup -ItemType Directory
Copy-Item .\yobot\src\client\public\static .\yobot\src\client\public\backup -Recurse -Force
Copy-Item .\yobot\src\client\public\template .\yobot\src\client\public\backup -Recurse -Force
}
Remove-Item .\yobot\src\client\public\static -Force -Recurse
Remove-Item .\yobot\src\client\public\template -Force -Recurse
Copy-Item .\YobotWebInterface\static .\yobot\src\client\public
Copy-Item .\YobotWebInterface\template .\yobot\src\client\public
Write-Output "更新完成!"
exit
}
else
{
Write-Output "没有项目文件夹,建议选择安装"
break
}
}
Default
{
Write-Output "你什么都没选哦~"
break
}
}