From 14fb79f7b0092cc6ffd9bff9b4610fe307576b05 Mon Sep 17 00:00:00 2001 From: Zach Dykstra Date: Sun, 26 Nov 2023 22:44:19 -0600 Subject: [PATCH] zfsbootmenu-core: use new zbm-release file, make zreport pretty --- zfsbootmenu/lib/zfsbootmenu-core.sh | 43 ++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/zfsbootmenu/lib/zfsbootmenu-core.sh b/zfsbootmenu/lib/zfsbootmenu-core.sh index 8881e6089..2854d4a12 100755 --- a/zfsbootmenu/lib/zfsbootmenu-core.sh +++ b/zfsbootmenu/lib/zfsbootmenu-core.sh @@ -1924,20 +1924,43 @@ emergency_shell() { # returns: nothing zreport() { - local ZBMTAG - if [ -r "/etc/zbm-commit-hash" ]; then - read -r ZBMTAG < /etc/zbm-commit-hash - echo -e "ZFSBootMenu version: ${ZBMTAG}\n" - fi - uname -a - echo -e "\n# modinfo" + colorize white "System Report\n\n" + + ( + VERSION="unknown" + PRETTY_NAME="ZFSBootMenu" + UNAME="$( uname -srm )" + + # shellcheck disable=SC1091 + [ -f /etc/zbm-release ] && source /etc/zbm-release + + if [[ "${VERSION}" =~ dev$ ]]; then + VERSION="$( colorize red "${VERSION}" )" + else + VERSION="$( colorize green "${VERSION}" )" + fi + + if [[ "${PRETTY_NAME}" == "ZFSBootMenu" ]]; then + PRETTY_NAME="$( colorize orange ZFS )$( colorize lightgray BootMenu )" + fi + + echo -e "${PRETTY_NAME} ${VERSION} (${UNAME})" + ) + + colorize orange "\n>> ZFSBootMenu commandline\n" + get_zbm_kcl | kcl_assemble + + colorize orange "\n\n>> ZFS/SPL module information\n" echo "$( modinfo -F filename spl ): $( modinfo -F version spl )" echo "$( modinfo -F filename zfs ): $( modinfo -F version zfs )" - echo -e "\n# zfs version" + + colorize orange "\n>> ZFS version\n" zfs version - echo -e "\n# zpool list" + + colorize orange "\n>> Imported zpools\n" zpool list - echo -e "\n# zfs list" + + colorize orange "\n>> ZFS datasets\n" zfs list -o name,mountpoint,encroot,keystatus,keylocation,org.zfsbootmenu:keysource }