1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 05:06:08 +03:00

caddy arm issue

This commit is contained in:
autumn 2021-06-11 11:00:57 +08:00
parent 3f397dbbf7
commit 424e0945db
9 changed files with 56 additions and 23 deletions

View File

@ -20,7 +20,10 @@ namespace ProxySuper.Core.Services
public void Uninstall()
{
UninstallCaddy();
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 uninstall");
RunCmd("rm -rf caddy_install.sh");
WriteOutput("ProxyNaive卸载完成");
}

View File

@ -395,10 +395,29 @@ namespace ProxySuper.Core.Services
/// </summary>
protected void InstallCaddy()
{
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");
RunCmd("rm -rf caddy_install.sh");
if (CmdType == CmdType.Apt)
{
RunCmd("sudo apt -y install debian-keyring debian-archive-keyring apt-transport-https");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list");
RunCmd("sudo apt -y update");
RunCmd("sudo apt -y install caddy");
}
if (CmdType == CmdType.Dnf)
{
RunCmd("dnf -y install 'dnf-command(copr)'");
RunCmd("dnf -y copr enable @caddy/caddy");
RunCmd("dnf -y install caddy");
}
if (CmdType == CmdType.Yum)
{
RunCmd("yum -y install yum-plugin-copr");
RunCmd("yum -y copr enable @caddy/caddy");
RunCmd("yum -y install caddy");
}
RunCmd("systemctl enable caddy.service");
}
@ -407,11 +426,25 @@ namespace ProxySuper.Core.Services
/// </summary>
protected void UninstallCaddy()
{
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 uninstall");
RunCmd("rm -rf caddy_install.sh");
RunCmd("systemctl stop caddy");
if (CmdType == CmdType.Apt)
{
RunCmd("sudo apt -y remove caddy");
}
if (CmdType == CmdType.Dnf)
{
RunCmd("dnf -y remove caddy");
}
if (CmdType == CmdType.Yum)
{
RunCmd("yum -y remove caddy");
}
RunCmd("rm -rf /usr/bin/caddy");
RunCmd("rm -rf /usr/share/caddy");
RunCmd("rm -rf /etc/caddy");
}
@ -435,7 +468,7 @@ namespace ProxySuper.Core.Services
if (string.IsNullOrEmpty(IPv6))
{
throw new Exception("未检测可用的的IP地址");
throw new Exception("未检测可用的的IP地址");
}
OnlyIpv6 = true;
@ -646,12 +679,12 @@ namespace ProxySuper.Core.Services
// 申请证书
if (OnlyIpv6)
{
var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --listen-v6 --pre-hook \"service caddy stop\" --post-hook \"service caddy start\"";
var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --listen-v6 --pre-hook \"systemctl stop caddy\" --post-hook \"systemctl start caddy\"";
result = RunCmd(cmd);
}
else
{
var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --pre-hook \"service caddy stop\" --post-hook \"service caddy start\"";
var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --pre-hook \"systemctl stop caddy\" --post-hook \"systemctl start caddy\"";
result = RunCmd(cmd);
}
@ -730,15 +763,15 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
return "echo y | apt-get install " + soft;
return "apt-get -y install " + soft;
}
else if (CmdType == CmdType.Dnf)
{
return "echo y | dnf -y install " + soft;
return "dnf -y install " + soft;
}
else if (CmdType == CmdType.Yum)
{
return "echo y | yum -y install " + soft;
return "yum -y install " + soft;
}
throw new Exception("未识别的系统");

View File

@ -48,8 +48,10 @@ namespace ProxySuper.Core.Services
public void Uninstall()
{
EnsureRootAuth();
EnsureSystemEnv();
RunCmd("systemctl stop trojan-go");
RunCmd("systemctl stop caddy");
base.UninstallCaddy();
RunCmd("rm -rf /usr/local/bin/trojan-go");
@ -133,7 +135,6 @@ namespace ProxySuper.Core.Services
private void InstallTrojanGo()
{
WriteOutput("安装Trojan-Go");
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh yes | bash");
var success = FileExists("/usr/local/bin/trojan-go");
if (success == false)

View File

@ -105,6 +105,7 @@ namespace ProxySuper.Core.Services
public void UninstallProxy()
{
EnsureRootAuth();
EnsureSystemEnv();
WriteOutput("卸载Caddy");
UninstallCaddy();
WriteOutput("卸载Xray");
@ -153,6 +154,7 @@ namespace ProxySuper.Core.Services
public void DoUninstallCaddy()
{
EnsureRootAuth();
EnsureSystemEnv();
UninstallCaddy();
WriteOutput("************ 卸载Caddy完成 ************");
}

View File

@ -43,7 +43,5 @@ namespace ProxySuper.Core.ViewModels
}
public string CommandText { get; set; }
public string OutputText { get; set; }
}
}

View File

@ -23,7 +23,6 @@
VerticalAlignment="Top"
VerticalContentAlignment="Top"
TextWrapping="WrapWithOverflow"
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="5" Orientation="Horizontal">

View File

@ -23,7 +23,6 @@
VerticalAlignment="Top"
VerticalContentAlignment="Top"
TextWrapping="WrapWithOverflow"
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="5" Orientation="Horizontal">

View File

@ -23,7 +23,6 @@
VerticalAlignment="Top"
VerticalContentAlignment="Top"
TextWrapping="WrapWithOverflow"
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="5" Orientation="Horizontal">

View File

@ -76,7 +76,6 @@ namespace ProxySuper.WPF.Views
outShell += "\n";
}
ViewModel.OutputText += outShell;
Dispatcher.Invoke(() =>
{
OutputTextBox.AppendText(outShell);