udev: fix loop devices exclusion based on directory flagfile

Getting loop device backing file path was broken:
${NAME%p*} for not-partitioned devices will cut the actual device name.
Use full name instead. This probably breaks handling partitioned
devices, but such devices should not appear in a directory flagged to be
ignored (VM images)

QubesOS/qubes-issues#3084
pull/18/head
Marek Marczykowski-Górecki 7 years ago
parent 0207537b50
commit c7420318e2
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

@ -45,7 +45,7 @@ refresh_another() {
# launch this script for other device
local devpath=$1
local launch_env=$(udevadm info -q all -x -p "$devpath" \
| grep ^E: | cut -d ' ' -f 2-)
| grep ^E: | cut -d ' ' -f 2- | tr ' ' ':')
env -i PATH=$PATH $launch_env $0
}
@ -122,7 +122,7 @@ fi
# ... and loop devices from excluded directories
if [[ "$NAME" = 'loop'* ]]; then
backing_file=$(cat /sys/block/${NAME%p*}/loop/backing_file)
backing_file=$(cat /sys/block/${NAME}/loop/backing_file)
if [ -n "$backing_file" ]; then
dir_to_check=$(dirname "$backing_file")
while [ "$dir_to_check" != "/" -a "$dir_to_check" != "." ]; do

Loading…
Cancel
Save