From f28d268737cedc763ff8fe79cb7ada2bf4a2cf7e Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 7 Aug 2024 00:31:20 +0800 Subject: [PATCH] fix lsblk ID is null --- files/initrd/opt/rr/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index b75c6bb3..ae6f5420 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -1755,7 +1755,7 @@ function formatDisks() { [ "${KNAME}" = "${LOADER_DISK}" -o "${PKNAME}" = "${LOADER_DISK}" ] && continue [ -z "${ID}" ] && ID="Unknown" printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${ID}" >>"${TMP_PATH}/opts" - done <<<$(lsblk -pno KNAME,ID,SIZE,TYPE,PKNAME) + done <<<$(lsblk -Jpno KNAME,ID,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.id) \(.size) \(.type) \(.pkname)"' 2>/dev/null) if [ ! -f "${TMP_PATH}/opts" ]; then DIALOG --title "$(TEXT "Advanced")" \ --msgbox "$(TEXT "No disk found!")" 0 0 @@ -2138,7 +2138,7 @@ function cloneBootloaderDisk() { [ -z "${KNAME}" -o -z "${ID}" ] && continue [ "${KNAME}" = "${LOADER_DISK}" -o "${PKNAME}" = "${LOADER_DISK}" ] && continue printf "\"%s\" \"%-6s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${ID}" >>"${TMP_PATH}/opts" - done <<<$(lsblk -dpno KNAME,ID,SIZE,PKNAME) + done <<<$(lsblk -Jpno KNAME,ID,SIZE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.id) \(.size) \(.pkname)"' 2>/dev/null) if [ ! -f "${TMP_PATH}/opts" ]; then DIALOG --title "$(TEXT "Advanced")" \ --msgbox "$(TEXT "No disk found!")" 0 0