mirror of
https://github.com/linuxboot/heads.git
synced 2025-03-27 22:28:42 +00:00
BUGFIX >2tb drives: replace all fdisk -l calls with stderr suppression (workaround)
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
parent
2d19fa9470
commit
836af32a42
@ -113,7 +113,7 @@ while true; do
|
|||||||
;;
|
;;
|
||||||
"b")
|
"b")
|
||||||
CURRENT_OPTION="$(load_config_value CONFIG_BOOT_DEV)"
|
CURRENT_OPTION="$(load_config_value CONFIG_BOOT_DEV)"
|
||||||
if ! fdisk -l | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist.txt; then
|
if ! fdisk -l 2>/dev/null | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist.txt; then
|
||||||
whiptail_error --title 'ERROR: No bootable devices found' \
|
whiptail_error --title 'ERROR: No bootable devices found' \
|
||||||
--msgbox " $ERROR\n\n" 0 80
|
--msgbox " $ERROR\n\n" 0 80
|
||||||
exit 1
|
exit 1
|
||||||
@ -208,7 +208,7 @@ while true; do
|
|||||||
;;
|
;;
|
||||||
"R")
|
"R")
|
||||||
CURRENT_OPTION="$(load_config_value CONFIG_ROOT_DEV)"
|
CURRENT_OPTION="$(load_config_value CONFIG_ROOT_DEV)"
|
||||||
fdisk -l | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist.txt
|
fdisk -l 2>/dev/null | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist.txt
|
||||||
# filter out extraneous options
|
# filter out extraneous options
|
||||||
>/tmp/root_device_list.txt
|
>/tmp/root_device_list.txt
|
||||||
for i in $(cat /tmp/disklist.txt); do
|
for i in $(cat /tmp/disklist.txt); do
|
||||||
|
@ -367,7 +367,7 @@ detect_root_device()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# generate list of possible boot devices
|
# generate list of possible boot devices
|
||||||
fdisk -l | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" > /tmp/disklist
|
fdisk -l 2>/dev/null | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" > /tmp/disklist
|
||||||
|
|
||||||
# filter out extraneous options
|
# filter out extraneous options
|
||||||
> /tmp_root_device_list
|
> /tmp_root_device_list
|
||||||
|
@ -645,7 +645,7 @@ device_has_partitions() {
|
|||||||
# This check covers that: [ $(fdisk -l "$b" | wc -l) -eq 5 ]
|
# This check covers that: [ $(fdisk -l "$b" | wc -l) -eq 5 ]
|
||||||
# In both cases the output is 5 lines: 3 about device info, 1 empty line
|
# In both cases the output is 5 lines: 3 about device info, 1 empty line
|
||||||
# and the 5th will be the table header or the invalid message.
|
# and the 5th will be the table header or the invalid message.
|
||||||
local DISK_DATA=$(fdisk -l "$DEVICE")
|
local DISK_DATA=$(fdisk -l "$DEVICE" 2>/dev/null)
|
||||||
if echo "$DISK_DATA" | grep -q "doesn't contain a valid partition table" ||
|
if echo "$DISK_DATA" | grep -q "doesn't contain a valid partition table" ||
|
||||||
[ "$(echo "$DISK_DATA" | wc -l)" -eq 5 ]; then
|
[ "$(echo "$DISK_DATA" | wc -l)" -eq 5 ]; then
|
||||||
# No partition table
|
# No partition table
|
||||||
@ -1066,7 +1066,7 @@ is_gpt_bios_grub() {
|
|||||||
# Now we know the device and partition number, get the type. This is
|
# Now we know the device and partition number, get the type. This is
|
||||||
# specific to GPT disks, MBR disks are shown differently by fdisk.
|
# specific to GPT disks, MBR disks are shown differently by fdisk.
|
||||||
TRACE "$PART_DEV is partition $NUMBER of $DEVICE"
|
TRACE "$PART_DEV is partition $NUMBER of $DEVICE"
|
||||||
if [ "$(fdisk -l "/dev/$DEVICE" | awk '$1 == '"$NUMBER"' {print $5}')" == grub ]; then
|
if [ "$(fdisk -l "/dev/$DEVICE" 2>/dev/null | awk '$1 == '"$NUMBER"' {print $5}')" == grub ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
@ -1139,7 +1139,7 @@ detect_boot_device() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# generate list of possible boot devices
|
# generate list of possible boot devices
|
||||||
fdisk -l | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist
|
fdisk -l 2>/dev/null | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" >/tmp/disklist
|
||||||
|
|
||||||
# Check each possible boot device
|
# Check each possible boot device
|
||||||
for i in $(cat /tmp/disklist); do
|
for i in $(cat /tmp/disklist); do
|
||||||
|
@ -181,7 +181,7 @@ show_system_info()
|
|||||||
kernel=$(uname -s -r)
|
kernel=$(uname -s -r)
|
||||||
|
|
||||||
whiptail_type $BG_COLOR_MAIN_MENU --title 'System Info' \
|
whiptail_type $BG_COLOR_MAIN_MENU --title 'System Info' \
|
||||||
--msgbox "${BOARD_NAME}\n\nFW_VER: ${FW_VER}\nKernel: ${kernel}\n\nCPU: ${cpustr}\nRAM: ${memtotal} GB\n$battery_status\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')" 0 80
|
--msgbox "${BOARD_NAME}\n\nFW_VER: ${FW_VER}\nKernel: ${kernel}\n\nCPU: ${cpustr}\nRAM: ${memtotal} GB\n$battery_status\n$(fdisk -l 2>/dev/null | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')" 0 80
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get "Enable" or "Disable" to display in the configuration menu, based on a
|
# Get "Enable" or "Disable" to display in the configuration menu, based on a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user