summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/storage.c15
-rw-r--r--src/storage.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
new file mode 100644
index 0000000..a6e21fa
--- /dev/null
+++ b/src/storage.c
@@ -0,0 +1,15 @@
+#include "storage.h"
+#include "common.h"
+
+#include <string.h>
+
+const char *display_storage() {
+ const char *iszfs = run_command_s("LC_ALL=C zpool list 2>&1");
+ if (strstr(iszfs, "command not found: zpool")) {
+ return run_command_s("zpool list | awk 'NR>1 {print $1 \": \" $3 \" / \" $2}' | "
+ "sed ':a;N;$!ba;s//, /g'");
+ }
+
+ return run_command_s("df -h | awk 'NR>1 {print $1 \": \" $3 \" / \" $2}' | "
+ "sed ':a;N;$!ba;s/\\n/, /g'");
+}
diff --git a/src/storage.h b/src/storage.h
new file mode 100644
index 0000000..9ec2217
--- /dev/null
+++ b/src/storage.h
@@ -0,0 +1,6 @@
+#ifndef STORAGE_H
+#define STORAGE_H
+
+const char *display_storage();
+
+#endif