From e609592b5513f057eeec3668c399a9524cf91e65 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Wed, 25 Jan 2023 10:50:14 +0100 Subject: [PATCH] code cleanup --- usr/lib/archboot/installer/blockdevices.sh | 29 ++-------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/usr/lib/archboot/installer/blockdevices.sh b/usr/lib/archboot/installer/blockdevices.sh index 558a7c381..dc72b3731 100644 --- a/usr/lib/archboot/installer/blockdevices.sh +++ b/usr/lib/archboot/installer/blockdevices.sh @@ -635,21 +635,6 @@ _createpv() #find physical volumes that are not in use _findpv() -{ - for dev in $(${_LSBLK} NAME,FSTYPE | grep " LVM2_member$" | cut -d' ' -f1 | sort -u); do - # exclude checks: - #- not part of running lvm2 - # ! "$(${_LSBLK} TYPE ${dev} | grep "lvm")" - #- not part of volume group - # $(pvs -o vg_name --noheading ${dev} | grep " $") - if ! ${_LSBLK} FSTYPE "${dev}" | grep -q "lvm" && pvs -o vg_name --noheading "${dev}" | grep -q " $"; then - echo "${dev}" - [[ "${1}" ]] && echo "${1}" - fi - done -} - -_getavailablepv() { for dev in $(${_LSBLK} NAME,FSTYPE | grep " LVM2_member$" | cut -d' ' -f1 | sort -u); do # exclude checks: @@ -665,16 +650,6 @@ _getavailablepv() #find volume groups that are not already full in use _findvg() -{ - for dev in $(vgs -o vg_name --noheading);do - if ! vgs -o vg_free --noheading --units m "${dev}" | grep -q " 0m$"; then - echo "${dev}" - [[ "${1}" ]] && echo "${1}" - fi - done -} - -_getavailablevg() { for dev in $(vgs -o vg_name --noheading); do if ! vgs -o vg_free --noheading --units m "${dev}" | grep -q " 0m$"; then @@ -690,7 +665,7 @@ _createvg() while [[ "${_VGFINISH}" != "DONE" ]]; do : >/tmp/.pvs _VGDEV="" - _PVS=$(_getavailablepv) + _PVS=$(_findpv) # break if all devices are in use if [[ -z "${_PVS}" ]]; then _dialog --msgbox "No devices left for Volume Group creation." 0 0 @@ -746,7 +721,7 @@ _createlv() while [[ "${_LVFINISH}" != "DONE" ]]; do _LVDEV="" _LV_SIZE_SET="" - _LVS=$(_getavailablevg) + _LVS=$(_findvg) # break if all devices are in use if [[ -z "${_LVS}" ]]; then _dialog --msgbox "No Volume Groups with free space available for Logical Volume creation." 0 0