Skip to content

Commit c77a758

Browse files
committed
Packages (Linux): support opkg
Fix #574
1 parent 12208b2 commit c77a758

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/detection/packages/packages.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ typedef struct FFPackagesResult
1919
uint32_t nixDefault;
2020
uint32_t nixSystem;
2121
uint32_t nixUser;
22+
uint32_t opkg;
2223
uint32_t pacman;
2324
uint32_t paludis;
2425
uint32_t pkg;

src/detection/packages/packages_linux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts)
280280
packageCounts->brewCask += getNumElements(baseDir, "/home/linuxbrew/.linuxbrew/Caskroom", DT_DIR);
281281
packageCounts->brew += getNumElements(baseDir, "/home/linuxbrew/.linuxbrew/Cellar", DT_DIR);
282282
packageCounts->paludis += countFilesRecursive(baseDir, "/var/db/paludis/repositories", "environment.bz2");
283+
packageCounts->opkg += getNumStrings(baseDir, "/usr/lib/opkg/status", "Package:"); // openwrt
283284
}
284285

285286
static void getPackageCountsRegular(FFstrbuf* baseDir, FFPackagesResult* packageCounts)

src/modules/packages/packages.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "modules/packages/packages.h"
55
#include "util/stringUtils.h"
66

7-
#define FF_PACKAGES_NUM_FORMAT_ARGS 24
7+
#define FF_PACKAGES_NUM_FORMAT_ARGS 25
88

99
void ffPrintPackages(FFPackagesOptions* options)
1010
{
@@ -64,6 +64,7 @@ void ffPrintPackages(FFPackagesOptions* options)
6464
FF_PRINT_PACKAGE(pkgtool)
6565
FF_PRINT_PACKAGE(paludis)
6666
FF_PRINT_PACKAGE(winget)
67+
FF_PRINT_PACKAGE(opkg)
6768

6869
putchar('\n');
6970
}
@@ -94,6 +95,7 @@ void ffPrintPackages(FFPackagesOptions* options)
9495
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkgtool},
9596
{FF_FORMAT_ARG_TYPE_UINT, &counts.paludis},
9697
{FF_FORMAT_ARG_TYPE_UINT, &counts.winget},
98+
{FF_FORMAT_ARG_TYPE_UINT, &counts.opkg},
9799
});
98100
}
99101

@@ -183,7 +185,7 @@ void ffGeneratePackagesJson(FF_MAYBE_UNUSED FFPackagesOptions* options, yyjson_m
183185

184186
void ffPrintPackagesHelpFormat(void)
185187
{
186-
ffPrintModuleFormatHelp(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget)", FF_PACKAGES_NUM_FORMAT_ARGS, (const char* []) {
188+
ffPrintModuleFormatHelp(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget), {25} (opkg)", FF_PACKAGES_NUM_FORMAT_ARGS, (const char* []) {
187189
"Number of all packages",
188190
"Number of pacman packages",
189191
"Pacman branch on manjaro",
@@ -206,7 +208,8 @@ void ffPrintPackagesHelpFormat(void)
206208
"Number of scoop packages",
207209
"Number of choco packages",
208210
"Number of pkgtool packages",
209-
"Number of paludis packages"
210-
"Number of winget packages"
211+
"Number of paludis packages",
212+
"Number of winget packages",
213+
"Number of opkg packages"
211214
});
212215
}

0 commit comments

Comments
 (0)