diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-19 15:43:28 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-19 15:43:28 +0900 |
commit | b79c513c07be42378167f412fa9bc35303f1a94a (patch) | |
tree | fb9aca141162628015873616a14d2349c6ec83b9 /src/packages.c | |
parent | 261b39692f5b0ba5cfad6e7be4c8b40b94852155 (diff) |
Linux: Debianベースのディストロのパッケージ情報対応
Diffstat (limited to 'src/packages.c')
-rw-r--r-- | src/packages.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/packages.c b/src/packages.c index a3a661a..e89eb82 100644 --- a/src/packages.c +++ b/src/packages.c @@ -3,6 +3,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #if defined(__linux__) #include "distro.h" @@ -53,9 +54,12 @@ void display_packages() { printf("%s (pkg)", run_package_command("pkg info -a | wc -l | " "sed \"s/ //g\"")); #elif defined(__linux__) - if (strncmp(distroname, "void", strlen("void")) == 0) { + if (access("/bin/xbps-query", F_OK) != -1) { printf("%s (xbps-query)", run_package_command("xbps-query -l | wc -l | " "sed \"s/ //g\"")); + } else if (access("/usr/bin/dpkg-query", F_OK) != -1) { + printf("%s (dpkg)", run_package_command("dpkg-query -f '.\n' -W | wc -l | " + "sed \"s/ //g\"")); } #endif } |