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
This commit is contained in:
parent
0207537b50
commit
c7420318e2
@ -45,7 +45,7 @@ refresh_another() {
|
|||||||
# launch this script for other device
|
# launch this script for other device
|
||||||
local devpath=$1
|
local devpath=$1
|
||||||
local launch_env=$(udevadm info -q all -x -p "$devpath" \
|
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
|
env -i PATH=$PATH $launch_env $0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ fi
|
|||||||
|
|
||||||
# ... and loop devices from excluded directories
|
# ... and loop devices from excluded directories
|
||||||
if [[ "$NAME" = 'loop'* ]]; then
|
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
|
if [ -n "$backing_file" ]; then
|
||||||
dir_to_check=$(dirname "$backing_file")
|
dir_to_check=$(dirname "$backing_file")
|
||||||
while [ "$dir_to_check" != "/" -a "$dir_to_check" != "." ]; do
|
while [ "$dir_to_check" != "/" -a "$dir_to_check" != "." ]; do
|
||||||
|
Loading…
Reference in New Issue
Block a user