修正ReleasName判断
This commit is contained in:
parent
5fc05096e6
commit
68d585a3b7
@ -53,6 +53,7 @@ namespace FastGithub.HttpServer
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
File.Delete(destCertFilePath);
|
||||
logger.LogWarning(ex.Message, "自动安装证书异常");
|
||||
}
|
||||
}
|
||||
@ -63,21 +64,22 @@ namespace FastGithub.HttpServer
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
protected bool IsReleasName(string name)
|
||||
protected static bool IsReleasName(string name)
|
||||
{
|
||||
if (File.Exists(OS_RELEASE_FILE) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var releaseLines = File.ReadAllLines(OS_RELEASE_FILE);
|
||||
if (releaseLines.Length == 0)
|
||||
foreach (var line in File.ReadAllLines(OS_RELEASE_FILE))
|
||||
{
|
||||
return false;
|
||||
if (line.StartsWith("NAME=") && line.Contains(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var nameLine = releaseLines[0];
|
||||
return nameLine.Contains(name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace FastGithub.HttpServer
|
||||
/// <returns></returns>
|
||||
public override bool IsSupported()
|
||||
{
|
||||
return OperatingSystem.IsLinux() && base.IsReleasName("CentOS");
|
||||
return OperatingSystem.IsLinux() && IsReleasName("CentOS");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ namespace FastGithub.HttpServer
|
||||
/// <returns></returns>
|
||||
public override bool IsSupported()
|
||||
{
|
||||
return OperatingSystem.IsLinux() && base.IsReleasName("Debian");
|
||||
return OperatingSystem.IsLinux() && IsReleasName("Debian");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ namespace FastGithub.HttpServer
|
||||
/// <returns></returns>
|
||||
public override bool IsSupported()
|
||||
{
|
||||
return OperatingSystem.IsLinux() && base.IsReleasName("Red Hat");
|
||||
return OperatingSystem.IsLinux() && IsReleasName("Red Hat");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace FastGithub.HttpServer
|
||||
/// <returns></returns>
|
||||
public override bool IsSupported()
|
||||
{
|
||||
return OperatingSystem.IsLinux() && base.IsReleasName("Ubuntu");
|
||||
return OperatingSystem.IsLinux() && IsReleasName("Ubuntu");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user