diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/packages/packages_sunos.c | |
Add the files
Diffstat (limited to 'src/detection/packages/packages_sunos.c')
| -rw-r--r-- | src/detection/packages/packages_sunos.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/detection/packages/packages_sunos.c b/src/detection/packages/packages_sunos.c new file mode 100644 index 0000000..16b8cd7 --- /dev/null +++ b/src/detection/packages/packages_sunos.c @@ -0,0 +1,17 @@ +#include "packages.h" +#include <dirent.h> + +void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) { + if (FF_PACKAGES_IS_ENABLED(options, PKG)) { + yyjson_doc* doc = yyjson_read_file(FASTFETCH_TARGET_DIR_ROOT "/var/pkg/state/installed/catalog.attrs", YYJSON_READ_NOFLAG, NULL, NULL); + if (doc) { + yyjson_val* packageCount = yyjson_obj_get(yyjson_doc_get_root(doc), "package-count"); + if (packageCount) { + result->pkg = (uint32_t) yyjson_get_uint(packageCount); + } + } + } + if (FF_PACKAGES_IS_ENABLED(options, PKGSRC)) { + result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/pkgdb", true); + } +} |