Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ If you get an error saying _Could not execute because the specified command or f
- Arch Linux
- Gentoo
- Slackware
- OpenSUSE Leap and SUSE Linux Enterprise Server (SLES). Tumbleweed and SLED untested but expected to work.
Comment thread
tmds marked this conversation as resolved.
Outdated

Limitations:

Expand Down
8 changes: 8 additions & 0 deletions src/linux-dev-certs/CertificateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ private bool CheckDependencies(HashSet<Dependency> dependencies, bool installMis
{
command = ["slackpkg", "install", ..packagesToInstall];
}
else if (OSFlavor.IsSUSELike)
{
command = ["zypper", "install", ..packagesToInstall];
}
else
{
command = [];
Expand Down Expand Up @@ -180,6 +184,10 @@ private bool CheckDependencies(HashSet<Dependency> dependencies, bool installMis
{
Console.Error.WriteLine($" slackpkg install {string.Join(", ", packagesToInstall)}");
}
else if (OSFlavor.IsSUSELike)
{
Console.Error.WriteLine($" zypper install {string.Join(", ", packagesToInstall)}");
}
else
{
Console.ForegroundColor = color;
Expand Down
4 changes: 4 additions & 0 deletions src/linux-dev-certs/NssCertificateDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ private string GetPackageForCertUtils()
{
return "mozilla-nss";
}
else if(OSFlavor.IsSUSELike)
{
return "mozilla-nss-tools";
}
else
{
OSFlavor.ThrowNotSupported();
Expand Down
1 change: 1 addition & 0 deletions src/linux-dev-certs/OSFlavor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ static class OSFlavor
public static bool IsArchLike => MatchesId("arch");
public static bool IsGentooLike => MatchesId("gentoo");
public static bool IsSlackLike => MatchesId("slackware");
public static bool IsSUSELike => MatchesId("suse");

private static string? _id;
private static string[]? _idLike;
Expand Down
18 changes: 17 additions & 1 deletion src/linux-dev-certs/SystemCertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sealed class SystemCertificateStore : ICertificateStore
private const string DebianFamilyCaSourceDirectory = "/usr/local/share/ca-certificates";
private const string ArchFamilyCaSourceDirectory = "/etc/ca-certificates/trust-source/anchors/";
private const string SlackFamilyCaSourceDirectory = "/usr/share/ca-certificates/mozilla/";
private const string SUSEFamilyCaSourceDirectory = "/usr/share/pki/trust/anchors/";
public string Name => "System Certificates";

public bool TryInstallCertificate(string name, X509Certificate2 certificate)
Expand Down Expand Up @@ -40,6 +41,17 @@ public bool TryInstallCertificate(string name, X509Certificate2 certificate)
certFilePath = $"{SlackFamilyCaSourceDirectory}/{name}.crt";
trustCommand = ["update-ca-certificates"];
}
else if (OSFlavor.IsSUSELike)
{
certFilePath = $"{SUSEFamilyCaSourceDirectory}/{name}.crt";

// Absolute since OpenSUSE/SLES do not include /usr/sbin in default PATH even for wheel users
trustCommand = ["/usr/sbin/update-ca-certificates"];

// OpenSUSE and SLES both also provide /usr/bin/trust in the base installation, but
// running this would miss any customization in /{etc,usr/lib}/ca-certificates/update.d
// trustCommand = ["trust", "extract-compat"];
Comment thread
tmds marked this conversation as resolved.
Outdated
}
else
{
OSFlavor.ThrowNotSupported();
Expand All @@ -64,6 +76,10 @@ public void AddDependencies(HashSet<Dependency> dependencies)
{
dependencies.Add(new Dependency("update-ca-certificates", "ca-certificates"));
}
else if (OSFlavor.IsSUSELike)
{
dependencies.Add(new Dependency("/usr/sbin/update-ca-certificates", "ca-certificates"));
}
else if (OSFlavor.IsArchLike)
{
dependencies.Add(new Dependency("trust", "p11-kit"));
Expand All @@ -75,5 +91,5 @@ public void AddDependencies(HashSet<Dependency> dependencies)
}

public bool IsSupported
=> OSFlavor.IsFedoraLike || OSFlavor.IsDebianLike || OSFlavor.IsArchLike || OSFlavor.IsSlackLike;
=> OSFlavor.IsFedoraLike || OSFlavor.IsDebianLike || OSFlavor.IsArchLike || OSFlavor.IsSlackLike || OSFlavor.IsSUSELike;
}
Loading