Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use zbm-release file, add some color to zreport #538

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions zfsbootmenu/lib/zfsbootmenu-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 6 additions & 1 deletion zfsbootmenu/libexec/zfsbootmenu-help
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ fi
for doc in "${doc_path}"/* ; do
SECTIONS+=( "${doc} $( head -1 "${doc}" )" )
done
SECTIONS+=( "zreport $( colorize white 'System Report' )" )

while getopts "lL:s:" opt; do
case "${opt}" in
Expand All @@ -92,7 +93,11 @@ while getopts "lL:s:" opt; do
exit
;;
s)
cat "${OPTARG}"
if [ "${OPTARG}" == "zreport" ]; then
/libexec/zfunc zreport
else
cat "${OPTARG}"
fi
exit
;;
?)
Expand Down