Fixed: Set musl status at compile time

This commit is contained in:
ta264 2021-01-27 21:35:20 +00:00 committed by Qstick
commit 3fcd8af697
2 changed files with 6 additions and 7 deletions

View file

@ -97,16 +97,14 @@ namespace NzbDrone.Common.EnvironmentInfo
}
else
{
return IsMusl() ? Os.LinuxMusl : Os.Linux;
#if ISMUSL
return Os.LinuxMusl;
#else
return Os.Linux;
#endif
}
}
private static bool IsMusl()
{
var output = RunAndCapture("ldd", "/bin/ls");
return output.Contains("libc.musl");
}
private static string RunAndCapture(string filename, string args)
{
Process p = new Process();

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<NeutralLanguage>en</NeutralLanguage>
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNet4.SocksProxy" Version="1.4.0.1" />