InitSystem (GNU): support shepherd detection

This commit is contained in:
Carter Li
2025-08-27 14:29:47 +08:00
committed by 李通洲
parent 00f163be32
commit 7a87638fec
2 changed files with 41 additions and 12 deletions
+9 -6
View File
@@ -84,16 +84,19 @@ const char* ffDetectInitSystem(FFInitSystemResult* result)
ffStrbufSubstrAfterLastC(&result->version, ' ');
}
}
else if (ffStrbufEqualS(&result->name, "guile"))
else if (ffStrbufEqualS(&result->name, "shepherd"))
{
// TODO: guile is actually shepherd
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
ffStrbufEndsWithS(&result->exe, "/guile") ? result->exe.chars : "guile",
"--version",
if (ffProcessAppendStdOut(&result->version, (char* const[]) {
ffStrbufEndsWithS(&result->exe, "/shepherd") ? result->exe.chars : "shepherd",
"--version",
NULL,
}) == NULL && result->version.length)
{
// guile (GNU Guile) 3.0.9
// shepherd (GNU Shepherd) 1.0.6
// The first line in the output might not contain the version
if (!ffStrbufStartsWithS(&result->version, "shepherd"))
ffStrbufSubstrAfterFirstC(&result->version, '\n');
ffStrbufSubstrBeforeFirstC(&result->version, '\n');
ffStrbufSubstrAfterLastC(&result->version, ' ');
}