silence blockdevices

This commit is contained in:
Tobias Powalowski 2023-01-06 19:47:00 +01:00
parent fd5564844e
commit 8a87e11833
2 changed files with 3 additions and 20 deletions

View file

@ -134,7 +134,7 @@ partitionable_raid_devices_partitions() {
# lists dmraid devices # lists dmraid devices
dmraid_devices() { dmraid_devices() {
for dev in $(${_LSBLK} NAME,TYPE | grep "dmraid$" | cut -d' ' -f 1 | grep -v "_.*p.*$" | sort -u); do for dev in $(${_LSBLK} NAME,TYPE 2>/dev/null | grep "dmraid$" | cut -d' ' -f 1 | grep -v "_.*p.*$" | sort -u); do
echo "${dev}" echo "${dev}"
[[ "${1}" ]] && echo "${1}" [[ "${1}" ]] && echo "${1}"
done done
@ -194,7 +194,6 @@ dmraid_partitions() {
# - show device mapper devices: # - show device mapper devices:
# lvm2 and cryptdevices # lvm2 and cryptdevices
dm_devices() { dm_devices() {
for dev in $(${_LSBLK} NAME,TYPE | grep -e "lvm$" -e "crypt$" | cut -d' ' -f1 | sort -u); do for dev in $(${_LSBLK} NAME,TYPE | grep -e "lvm$" -e "crypt$" | cut -d' ' -f1 | sort -u); do
# exclude checks: # exclude checks:
# - part of lvm2 device # - part of lvm2 device
@ -205,7 +204,7 @@ dm_devices() {
# ${_LSBLK} FSTYPE ${dev} | grep "linux_raid_member$" # ${_LSBLK} FSTYPE ${dev} | grep "linux_raid_member$"
# - part of running raid on encrypted device # - part of running raid on encrypted device
# ${_LSBLK} TYPE ${dev} | grep "raid.*$ # ${_LSBLK} TYPE ${dev} | grep "raid.*$
if ! ${_LSBLK} FSTYPE "${dev}" | grep -q "crypto_LUKS$" 2>/dev/null && ! ${_LSBLK} FSTYPE "${dev}" | grep -q "LVM2_member$" 2>/dev/null && ! ${_LSBLK} FSTYPE "${dev}" 2>/dev/null | grep -q "linux_raid_member$" && ! ${_LSBLK} TYPE "${dev}" 2>/dev/null | grep -q "raid.*$"; then if ! ${_LSBLK} FSTYPE "${dev}" 2>/dev/null | grep -q "crypto_LUKS$" && ! ${_LSBLK} FSTYPE "${dev}" 2>/dev/null | grep -q "LVM2_member$" && ! ${_LSBLK} FSTYPE "${dev}" 2>/dev/null | grep -q "linux_raid_member$" && ! ${_LSBLK} TYPE "${dev}" 2>/dev/null | grep -q "raid.*$"; then
echo "${dev}" echo "${dev}"
[[ "${1}" ]] && echo "${1}" [[ "${1}" ]] && echo "${1}"
fi fi
@ -234,15 +233,6 @@ findbootloaderdisks() {
fi fi
} }
# don't list raid devices, lvm2 and devicemapper!
findbootloaderpartitions() {
if ! [[ "${USE_DMRAID}" == "1" ]]; then
blockdevices_partitions "${1}"
else
dmraid_partitions "${1}"
fi
}
# activate_dmraid() # activate_dmraid()
# activate dmraid devices # activate dmraid devices
activate_dmraid() activate_dmraid()

View file

@ -802,12 +802,10 @@ do_grub_bios() {
# check if mapper is used # check if mapper is used
if echo "${bootdev}" | grep -q /dev/mapper; then if echo "${bootdev}" | grep -q /dev/mapper; then
RAID_ON_LVM="0" RAID_ON_LVM="0"
#check if mapper contains a md device! #check if mapper contains a md device!
for devpath in $(pvs -o pv_name --noheading); do for devpath in $(pvs -o pv_name --noheading); do
if echo "${devpath}" | grep -v "/dev/md.p" | grep /dev/md; then if echo "${devpath}" | grep -v "/dev/md.p" | grep /dev/md; then
detectedvolumegroup="$(pvs -o vg_name --noheading "${devpath}")" detectedvolumegroup="$(pvs -o vg_name --noheading "${devpath}")"
if echo /dev/mapper/"${detectedvolumegroup}"-* | grep "${bootdev}"; then if echo /dev/mapper/"${detectedvolumegroup}"-* | grep "${bootdev}"; then
# change bootdev to md device! # change bootdev to md device!
bootdev=$(pvs -o pv_name --noheading "${devpath}") bootdev=$(pvs -o pv_name --noheading "${devpath}")
@ -817,7 +815,6 @@ do_grub_bios() {
fi fi
done done
fi fi
#check if raid is used #check if raid is used
USE_RAID="" USE_RAID=""
if echo "${bootdev}" | grep -q /dev/md; then if echo "${bootdev}" | grep -q /dev/md; then
@ -828,7 +825,6 @@ do_grub_bios() {
# - LVM and RAID ${bootdev} needs the MBR of a device and cannot be used itself as ${bootdev} # - LVM and RAID ${bootdev} needs the MBR of a device and cannot be used itself as ${bootdev}
if [[ "${FAIL_COMPLEX}" == "0" ]]; then if [[ "${FAIL_COMPLEX}" == "0" ]]; then
DEVS="$(findbootloaderdisks _)" DEVS="$(findbootloaderdisks _)"
if [[ "${DEVS}" == "" ]]; then if [[ "${DEVS}" == "" ]]; then
DIALOG --msgbox "No storage drives were found" 0 0 DIALOG --msgbox "No storage drives were found" 0 0
return 1 return 1
@ -837,11 +833,8 @@ do_grub_bios() {
DIALOG --menu "Select the boot device where the GRUB(2) bootloader will be installed." 14 55 7 ${DEVS} 2>"${ANSWER}" || return 1 DIALOG --menu "Select the boot device where the GRUB(2) bootloader will be installed." 14 55 7 ${DEVS} 2>"${ANSWER}" || return 1
bootdev=$(cat "${ANSWER}") bootdev=$(cat "${ANSWER}")
else else
DEVS="$(findbootloaderdisks _)"
## grub BIOS install to partition is not supported ## grub BIOS install to partition is not supported
# DEVS="${DEVS} $(findbootloaderpartitions _)" DEVS="$(findbootloaderdisks _)"
if [[ "${DEVS}" == "" ]]; then if [[ "${DEVS}" == "" ]]; then
DIALOG --msgbox "No storage drives were found" 0 0 DIALOG --msgbox "No storage drives were found" 0 0
return 1 return 1