fix detect_disk

This commit is contained in:
Tobias Powalowski 2023-06-23 14:54:33 +02:00
parent 25ca6b3e5d
commit 1e5e34949b

View file

@ -2,14 +2,14 @@
# SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org>
_detect_disk() {
if [[ -z "${_DISK}" ]] || ! echo "${_DISK}" | grep -q '/dev/' || findmnt -vno SOURCE "${_DESTDIR}/boot"; then
if [[ -z "${_DISK}" ]]; then
if findmnt -vno SOURCE "${_DESTDIR}/boot"; then
if findmnt -vno SOURCE "${_DESTDIR}/boot" | grep -qw systemd-1; then
_DISK="$(${_LSBLK} PKNAME "$(findmnt -vno SOURCE "${_DESTDIR}/boot" | grep -vw systemd-1)")"
else
_DISK="$(${_LSBLK} PKNAME "$(findmnt -vno SOURCE "${_DESTDIR}/boot")")"
fi
fi
if [[ -z "${_DISK}" ]]; then
_DISK="$(${_LSBLK} PKNAME "$(findmnt -vno SOURCE "${_DESTDIR}/")")"
fi
}