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>
|
/// </summary>
|
||||||
protected void InstallCaddy()
|
protected void InstallCaddy()
|
||||||
{
|
{
|
||||||
if (CmdType == CmdType.Apt)
|
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("sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https");
|
RunCmd("yes | bash caddy_install.sh");
|
||||||
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");
|
//if (CmdType == CmdType.Apt)
|
||||||
RunCmd("sudo apt update");
|
//{
|
||||||
RunCmd("sudo apt install caddy");
|
// 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 -");
|
||||||
else if (CmdType == CmdType.Dnf)
|
// 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("dnf install 'dnf-command(copr)'");
|
// RunCmd("sudo apt install caddy");
|
||||||
RunCmd("dnf copr enable @caddy/caddy");
|
//}
|
||||||
RunCmd(GetUpdateCmd());
|
//else if (CmdType == CmdType.Dnf)
|
||||||
RunCmd("dnf install caddy");
|
//{
|
||||||
}
|
// RunCmd("echo y | dnf install 'dnf-command(copr)'");
|
||||||
else if (CmdType == CmdType.Yum)
|
// RunCmd("echo y | dnf copr enable @caddy/caddy");
|
||||||
{
|
// RunCmd(GetUpdateCmd());
|
||||||
RunCmd("y | yum install yum-plugin-copr");
|
// RunCmd("dnf install caddy");
|
||||||
RunCmd("yum copr enable @caddy/caddy");
|
//}
|
||||||
RunCmd(GetUpdateCmd());
|
//else if (CmdType == CmdType.Yum)
|
||||||
RunCmd("yum install caddy");
|
//{
|
||||||
}
|
// 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)
|
if (CmdType == CmdType.Apt)
|
||||||
{
|
{
|
||||||
return "apt-get update ";
|
return "echo y | apt-get update ";
|
||||||
}
|
}
|
||||||
else if (CmdType == CmdType.Dnf)
|
else if (CmdType == CmdType.Dnf)
|
||||||
{
|
{
|
||||||
return "dnf clean all;dnf makecache";
|
return "echo y | dnf update ";
|
||||||
}
|
}
|
||||||
else if (CmdType == CmdType.Yum)
|
else if (CmdType == CmdType.Yum)
|
||||||
{
|
{
|
||||||
return "yum clean all;yum makecache";
|
return "echo y | yum update ";
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("未识别的系统");
|
throw new Exception("未识别的系统");
|
||||||
|
@ -35,16 +35,32 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
EnsureSystemEnv();
|
EnsureSystemEnv();
|
||||||
this.InstallCertToXray();
|
this.InstallCertToXray();
|
||||||
RunCmd("systemctl restart xray");
|
RunCmd("systemctl restart xray");
|
||||||
|
WriteOutput("安装证书完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UploadWeb(Stream stream)
|
public void UploadWeb(Stream stream)
|
||||||
{
|
{
|
||||||
EnsureRootAuth();
|
EnsureRootAuth();
|
||||||
EnsureSystemEnv();
|
EnsureSystemEnv();
|
||||||
|
if (!FileExists("/usr/share/caddy"))
|
||||||
|
{
|
||||||
|
RunCmd("mkdir /usr/share/caddy");
|
||||||
|
}
|
||||||
RunCmd("rm -rf /usr/share/caddy/*");
|
RunCmd("rm -rf /usr/share/caddy/*");
|
||||||
UploadFile(stream, "/usr/share/caddy/caddy.zip");
|
UploadFile(stream, "/usr/share/caddy/caddy.zip");
|
||||||
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
|
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
|
||||||
RunCmd("chmod -R 777 /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"));
|
RunCmd(GetInstallCmd("socat"));
|
||||||
|
|
||||||
// 解决搬瓦工CentOS缺少问题
|
// 解决搬瓦工CentOS缺少问题
|
||||||
RunCmd("y | " + GetInstallCmd("automake autoconf libtool"));
|
RunCmd("echo y | " + GetInstallCmd("automake autoconf libtool"));
|
||||||
|
|
||||||
// 安装Acme
|
// 安装Acme
|
||||||
var result = RunCmd($"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m {GetRandomEmail()}");
|
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"
|
Width="120"
|
||||||
IsEnabled="{Binding HasConnected}"
|
IsEnabled="{Binding HasConnected}"
|
||||||
Click="UploadWeb"/>
|
Click="UploadWeb"/>
|
||||||
|
|
||||||
|
<Button Content="重装Caddy"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Click="ReinstallCaddy"
|
||||||
|
Height="32"
|
||||||
|
IsEnabled="{Binding HasConnected}"
|
||||||
|
Width="120"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Margin="10,0,0,0">
|
<StackPanel Margin="10,0,0,0">
|
||||||
|
@ -146,6 +146,14 @@ namespace ProxySU_Core
|
|||||||
fileDialog.ShowDialog();
|
fileDialog.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReinstallCaddy(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
project.ReinstallCaddy();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void OnFileOk(object sender, CancelEventArgs e)
|
private void OnFileOk(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user