udev-block-add-change: fix checking if partition is mounted

is_used() function should operate on its argument, not global $DEVNAME.
This commit is contained in:
Marek Marczykowski-Górecki 2016-07-17 05:08:25 +02:00
parent 3422cffe0d
commit e0acdee23c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -24,8 +24,9 @@ xs_remove() {
is_used() {
local sys_devpath=$1
local devname=$(grep ^DEVNAME= $sys_devpath/uevent | cut -f 2 -d =)
# mounted; or enabled swap
if lsblk -dnr -o MOUNTPOINT "$DEVNAME" | grep -q .; then
if lsblk -dnr -o MOUNTPOINT "/dev/$devname" | grep -q .; then
return 0
fi
# part of other device-mapper