mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
5e6892dd8b
Doing 'grep -F "$dev on "' to find the mounted device is not always accurate, e.g. SCRATCH_DEV=/vda6 is mounted but not on SCRATCH_MNT=/vda6/ovl-mnt - aborting Already mounted result: /dev/vda6 on /vda6 type xfs (rw,relatime,context=system_u:object_r:nfs_t:s0,attr2,inode64,noquota) Fix it by using findmnt command and specifying the $dev as mount source, print the result in "$dev $mnt" format. This works for local filesystems, network filesystems and overlayfs, avoids all kinds of tricky and error-prone grep pattern/regex. Also fixed the if-then-fi format in _check_mounted_on() while we're at it. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>