From 0c0f5544aa3ee96caaf34af7026d5f8078ee532a Mon Sep 17 00:00:00 2001 From: ProxySU Date: Sun, 15 Mar 2020 00:55:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A3=80=E6=B5=8B=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProxySU/MainWindow.xaml.cs | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index fa495bd..d1a1545 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -383,22 +383,29 @@ namespace ProxySU //MessageBox.Show(result.Result); //MessageBox.Show(linuxKernelVerStr[0]); bool detectResult = DetectKernelVersion(linuxKernelVerStr[0]); - if (detectResult == true) - { - currentStatus = "符合安装要求,布署中......"; - textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); - Thread.Sleep(2000); - } - else + if (detectResult == false) { MessageBox.Show($"当前系统内核版本为{linuxKernelVerStr[0]},V2ray要求内核为2.6.23及以上。请升级内核再安装!"); currentStatus = "系统内核版本不符合要求,安装失败!!"; textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); - Thread.Sleep(2000); - + Thread.Sleep(2000); } + //detectResult = DetectReleaseVersion(string releaseVer); + //检测系统是否支持yum 或 apt-get或zypper,且支持Systemd, + if (((string.IsNullOrEmpty(client.RunCommand("command -v apt-get").Result) == false) || string.IsNullOrEmpty(client.RunCommand("command -v yum").Result) == false || string.IsNullOrEmpty(client.RunCommand("command -v zypper").Result) == false) && string.IsNullOrEmpty(client.RunCommand("command -v systemctl").Result) == true) + { + MessageBox.Show($"系统缺乏必要的安装组件如:apt-get||yum||zypper||Syetemd,推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本"); + currentStatus = "系统环境不满足要求,安装失败!!"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(2000); + return; + } + + currentStatus = "符合安装要求,布署中......"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(2000); - //运行命令 + //运行命令 //client.RunCommand("apt update"); //client.RunCommand("apt install curl -y"); //client.RunCommand("bash <(curl -L -s https://install.direct/go.sh)"); @@ -550,12 +557,8 @@ namespace ProxySU return false; } - //检测发行版本号是否为centos7/8 debian 8/9/10 ubuntu 16.04及以上 - private static bool DetectReleaseVersion(string releasever) - { - - return true; - } + + }