summaryrefslogtreecommitdiff
path: root/src/storage.c
blob: a6e21fa57077c10b6d7639d3b2a4e925d478e14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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'");
}