diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinux.cs b/FastGithub.HttpServer/CaCertInstallerOfLinux.cs
index 12ceab3..12af24a 100644
--- a/FastGithub.HttpServer/CaCertInstallerOfLinux.cs
+++ b/FastGithub.HttpServer/CaCertInstallerOfLinux.cs
@@ -53,6 +53,7 @@ namespace FastGithub.HttpServer
}
catch (Exception ex)
{
+ File.Delete(destCertFilePath);
logger.LogWarning(ex.Message, "自动安装证书异常");
}
}
@@ -63,21 +64,22 @@ namespace FastGithub.HttpServer
///
///
///
- 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;
}
}
}
\ No newline at end of file
diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinuxCentOS.cs b/FastGithub.HttpServer/CaCertInstallerOfLinuxCentOS.cs
index 1600670..3ed7031 100644
--- a/FastGithub.HttpServer/CaCertInstallerOfLinuxCentOS.cs
+++ b/FastGithub.HttpServer/CaCertInstallerOfLinuxCentOS.cs
@@ -10,7 +10,7 @@ namespace FastGithub.HttpServer
///
public override bool IsSupported()
{
- return OperatingSystem.IsLinux() && base.IsReleasName("CentOS");
+ return OperatingSystem.IsLinux() && IsReleasName("CentOS");
}
}
}
\ No newline at end of file
diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinuxDebian.cs b/FastGithub.HttpServer/CaCertInstallerOfLinuxDebian.cs
index 3a7cf08..802fdf9 100644
--- a/FastGithub.HttpServer/CaCertInstallerOfLinuxDebian.cs
+++ b/FastGithub.HttpServer/CaCertInstallerOfLinuxDebian.cs
@@ -14,7 +14,7 @@ namespace FastGithub.HttpServer
///
public override bool IsSupported()
{
- return OperatingSystem.IsLinux() && base.IsReleasName("Debian");
+ return OperatingSystem.IsLinux() && IsReleasName("Debian");
}
}
}
\ No newline at end of file
diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinuxRedHat.cs b/FastGithub.HttpServer/CaCertInstallerOfLinuxRedHat.cs
index 28f908f..cfa0441 100644
--- a/FastGithub.HttpServer/CaCertInstallerOfLinuxRedHat.cs
+++ b/FastGithub.HttpServer/CaCertInstallerOfLinuxRedHat.cs
@@ -14,7 +14,7 @@ namespace FastGithub.HttpServer
///
public override bool IsSupported()
{
- return OperatingSystem.IsLinux() && base.IsReleasName("Red Hat");
+ return OperatingSystem.IsLinux() && IsReleasName("Red Hat");
}
}
}
\ No newline at end of file
diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinuxUbuntu.cs b/FastGithub.HttpServer/CaCertInstallerOfLinuxUbuntu.cs
index d94b3e1..fa0371a 100644
--- a/FastGithub.HttpServer/CaCertInstallerOfLinuxUbuntu.cs
+++ b/FastGithub.HttpServer/CaCertInstallerOfLinuxUbuntu.cs
@@ -10,7 +10,7 @@ namespace FastGithub.HttpServer
///
public override bool IsSupported()
{
- return OperatingSystem.IsLinux() && base.IsReleasName("Ubuntu");
+ return OperatingSystem.IsLinux() && IsReleasName("Ubuntu");
}
}
}
\ No newline at end of file