mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-25 06:36:08 +03:00
fix centos install caddy issue
This commit is contained in:
parent
b5978e738d
commit
25f322d35c
@ -347,28 +347,32 @@ namespace ProxySU_Core.ViewModels.Developers
|
||||
/// </summary>
|
||||
protected void InstallCaddy()
|
||||
{
|
||||
if (CmdType == CmdType.Apt)
|
||||
{
|
||||
RunCmd("sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https");
|
||||
RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
|
||||
RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list");
|
||||
RunCmd("sudo apt update");
|
||||
RunCmd("sudo apt install caddy");
|
||||
}
|
||||
else if (CmdType == CmdType.Dnf)
|
||||
{
|
||||
RunCmd("dnf install 'dnf-command(copr)'");
|
||||
RunCmd("dnf copr enable @caddy/caddy");
|
||||
RunCmd(GetUpdateCmd());
|
||||
RunCmd("dnf install caddy");
|
||||
}
|
||||
else if (CmdType == CmdType.Yum)
|
||||
{
|
||||
RunCmd("y | yum install yum-plugin-copr");
|
||||
RunCmd("yum copr enable @caddy/caddy");
|
||||
RunCmd(GetUpdateCmd());
|
||||
RunCmd("yum install caddy");
|
||||
}
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
|
||||
RunCmd("yes | bash caddy_install.sh");
|
||||
|
||||
//if (CmdType == CmdType.Apt)
|
||||
//{
|
||||
// RunCmd("sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("sudo apt install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Dnf)
|
||||
//{
|
||||
// RunCmd("echo y | dnf install 'dnf-command(copr)'");
|
||||
// RunCmd("echo y | dnf copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("dnf install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Yum)
|
||||
//{
|
||||
// RunCmd("echo y | echo y | yum install yum-plugin-copr");
|
||||
// RunCmd("echo y | echo y | yum copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("yum install caddy");
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@ -526,15 +530,15 @@ namespace ProxySU_Core.ViewModels.Developers
|
||||
{
|
||||
if (CmdType == CmdType.Apt)
|
||||
{
|
||||
return "apt-get update ";
|
||||
return "echo y | apt-get update ";
|
||||
}
|
||||
else if (CmdType == CmdType.Dnf)
|
||||
{
|
||||
return "dnf clean all;dnf makecache";
|
||||
return "echo y | dnf update ";
|
||||
}
|
||||
else if (CmdType == CmdType.Yum)
|
||||
{
|
||||
return "yum clean all;yum makecache";
|
||||
return "echo y | yum update ";
|
||||
}
|
||||
|
||||
throw new Exception("未识别的系统");
|
||||
|
@ -35,16 +35,32 @@ namespace ProxySU_Core.ViewModels.Developers
|
||||
EnsureSystemEnv();
|
||||
this.InstallCertToXray();
|
||||
RunCmd("systemctl restart xray");
|
||||
WriteOutput("安装证书完成");
|
||||
}
|
||||
|
||||
public void UploadWeb(Stream stream)
|
||||
{
|
||||
EnsureRootAuth();
|
||||
EnsureSystemEnv();
|
||||
if (!FileExists("/usr/share/caddy"))
|
||||
{
|
||||
RunCmd("mkdir /usr/share/caddy");
|
||||
}
|
||||
RunCmd("rm -rf /usr/share/caddy/*");
|
||||
UploadFile(stream, "/usr/share/caddy/caddy.zip");
|
||||
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
|
||||
RunCmd("chmod -R 777 /usr/share/caddy");
|
||||
RunCmd("systemctl restart caddy");
|
||||
WriteOutput("上传网站模板完成");
|
||||
}
|
||||
|
||||
public void ReinstallCaddy()
|
||||
{
|
||||
EnsureRootAuth();
|
||||
EnsureSystemEnv();
|
||||
InstallCaddy();
|
||||
UploadCaddyFile();
|
||||
WriteOutput("重装Caddy完成");
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +173,7 @@ namespace ProxySU_Core.ViewModels.Developers
|
||||
RunCmd(GetInstallCmd("socat"));
|
||||
|
||||
// 解决搬瓦工CentOS缺少问题
|
||||
RunCmd("y | " + GetInstallCmd("automake autoconf libtool"));
|
||||
RunCmd("echo y | " + GetInstallCmd("automake autoconf libtool"));
|
||||
|
||||
// 安装Acme
|
||||
var result = RunCmd($"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m {GetRandomEmail()}");
|
||||
|
@ -46,6 +46,13 @@
|
||||
Width="120"
|
||||
IsEnabled="{Binding HasConnected}"
|
||||
Click="UploadWeb"/>
|
||||
|
||||
<Button Content="重装Caddy"
|
||||
Margin="10,0,0,0"
|
||||
Click="ReinstallCaddy"
|
||||
Height="32"
|
||||
IsEnabled="{Binding HasConnected}"
|
||||
Width="120"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="10,0,0,0">
|
||||
|
@ -146,6 +146,14 @@ namespace ProxySU_Core
|
||||
fileDialog.ShowDialog();
|
||||
}
|
||||
|
||||
private void ReinstallCaddy(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
project.ReinstallCaddy();
|
||||
});
|
||||
}
|
||||
|
||||
private void OnFileOk(object sender, CancelEventArgs e)
|
||||
{
|
||||
Task.Factory.StartNew(() =>
|
||||
|
Loading…
Reference in New Issue
Block a user