Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 7f58221

Browse files
authored
Merge pull request #272 from ospalax/b-266-fix-nofsroot-in-old-os
B #266: Workaround old broken util-linux
2 parents f976d99 + 37b46e1 commit 7f58221

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/etc/one-context.d/loc-05-grow-rootfs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,16 @@ for _FS in ${GROW_FS} ; do
224224

225225
LVM=$(lvdisplay "${DEVICE}" 2>/dev/null | wc -l)
226226
if [ "$LVM" -eq 0 ]; then
227-
# findmnt support --nofsroot since util-linux v2.19.1
228-
DEVICE=$(findmnt -ln -o SOURCE --nofsroot "$_FS")
227+
# findmnt supports --nofsroot since util-linux v2.19.1 but
228+
# unfortunately this is broken even in v2.20 (Ubuntu 14.04)
229+
# so trivial test follows which should filter out old and broken
230+
# versions...
231+
if findmnt -V >/dev/null 2>&1 ; then
232+
DEVICE=$(findmnt -ln -o SOURCE --nofsroot "$_FS")
233+
else
234+
# old broken util-linux does not have the -V option
235+
DEVICE=$(findmnt -ln -o SOURCE "$_FS")
236+
fi
229237
DISK=$(echo "$DEVICE" | sed 's/[0-9]*$//')
230238
PARTITION=$(echo "$DEVICE" | sed "s|^$DISK||")
231239
LVM="no"

0 commit comments

Comments
 (0)