From 37b46e1a4c1b14d9df70877357b737f6fcf1bf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ospal=C3=BD?= Date: Tue, 31 May 2022 20:00:37 +0200 Subject: [PATCH] B #266: Workaround old broken util-linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Petr OspalĂ˝ --- src/etc/one-context.d/loc-05-grow-rootfs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/etc/one-context.d/loc-05-grow-rootfs b/src/etc/one-context.d/loc-05-grow-rootfs index db3e04a..d9c924c 100755 --- a/src/etc/one-context.d/loc-05-grow-rootfs +++ b/src/etc/one-context.d/loc-05-grow-rootfs @@ -224,8 +224,16 @@ for _FS in ${GROW_FS} ; do LVM=$(lvdisplay "${DEVICE}" 2>/dev/null | wc -l) if [ "$LVM" -eq 0 ]; then - # findmnt support --nofsroot since util-linux v2.19.1 - DEVICE=$(findmnt -ln -o SOURCE --nofsroot "$_FS") + # findmnt supports --nofsroot since util-linux v2.19.1 but + # unfortunately this is broken even in v2.20 (Ubuntu 14.04) + # so trivial test follows which should filter out old and broken + # versions... + if findmnt -V >/dev/null 2>&1 ; then + DEVICE=$(findmnt -ln -o SOURCE --nofsroot "$_FS") + else + # old broken util-linux does not have the -V option + DEVICE=$(findmnt -ln -o SOURCE "$_FS") + fi DISK=$(echo "$DEVICE" | sed 's/[0-9]*$//') PARTITION=$(echo "$DEVICE" | sed "s|^$DISK||") LVM="no"