Skip to content

Commit 0f64e28

Browse files
committed
OS (Linux): detect pve & armbian
1 parent 3e24cdc commit 0f64e28

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/detection/os/os_linux.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "common/properties.h"
33
#include "common/parsing.h"
44
#include "common/io/io.h"
5+
#include "common/processing.h"
56
#include "util/stringUtils.h"
67

78
#include <string.h>
@@ -142,6 +143,36 @@ static void getDebianVersion(FFOSResult* result)
142143
ffStrbufSet(&result->versionID, &debianVersion);
143144
}
144145

146+
static void detectDebianDerived(FFOSResult* result)
147+
{
148+
if (ffStrbufStartsWithS(&result->prettyName, "Armbian ")) // Armbian 24.2.1 bookworm
149+
{
150+
ffStrbufSetS(&result->name, "Armbian");
151+
ffStrbufSetS(&result->id, "armbian");
152+
ffStrbufSetS(&result->idLike, "debian");
153+
ffStrbufClear(&result->versionID);
154+
uint32_t versionStart = ffStrbufFirstIndexC(&result->prettyName, ' ') + 1;
155+
uint32_t versionEnd = ffStrbufNextIndexC(&result->prettyName, versionStart, ' ');
156+
ffStrbufSetNS(&result->versionID, versionEnd - versionStart, result->prettyName.chars + versionStart);
157+
}
158+
else if (ffPathExists("/usr/bin/pveversion", FF_PATHTYPE_FILE))
159+
{
160+
ffStrbufSetS(&result->id, "pve");
161+
ffStrbufSetS(&result->idLike, "debian");
162+
ffStrbufSetS(&result->name, "Proxmox VE");
163+
ffStrbufClear(&result->versionID);
164+
if (ffProcessAppendStdOut(&result->versionID, (char* const[]) {
165+
"/usr/bin/pveversion",
166+
NULL,
167+
}) == NULL) // pve-manager/8.2.2/9355359cd7afbae4 (running kernel: 6.8.4-2-pve)
168+
{
169+
ffStrbufSubstrBeforeLastC(&result->versionID, '/');
170+
ffStrbufSubstrAfterFirstC(&result->versionID, '/');
171+
}
172+
ffStrbufSetF(&result->prettyName, "Proxmox VE %s", result->versionID.chars);
173+
}
174+
}
175+
145176
static void detectOS(FFOSResult* os)
146177
{
147178
#ifdef FF_CUSTOM_OS_RELEASE_PATH
@@ -195,5 +226,8 @@ void ffDetectOSImpl(FFOSResult* os)
195226
if(ffStrbufIgnCaseEqualS(&os->id, "ubuntu"))
196227
getUbuntuFlavour(os);
197228
else if(ffStrbufIgnCaseEqualS(&os->id, "debian"))
229+
{
230+
detectDebianDerived(os);
198231
getDebianVersion(os);
232+
}
199233
}

src/logo/builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3354,7 +3354,7 @@ static const FFlogo P[] = {
33543354
},
33553355
// Proxmox
33563356
{
3357-
.names = {"proxmox"},
3357+
.names = {"Proxmox", "pve"},
33583358
.lines = FASTFETCH_DATATEXT_LOGO_PROXMOX,
33593359
.colors = {
33603360
FF_COLOR_FG_WHITE,

0 commit comments

Comments
 (0)