diff options
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); + } +} |