[arch-releng] [PATCH 2/2] dev_used_by_environment(): follow symlinks

Thomas Hebb tommyhebb at gmail.com
Sat May 19 20:04:30 EDT 2012


Make dev_used_by_environment follow symbolic links before checking to
see if a device should be excluded. This assumes that the paths in
/run/aif/ignore_block_devices are fully resolved.

Signed-off-by: Thomas Hebb <tommyhebb at gmail.com>
---
 src/core/libs/lib-blockdevices-filesystems.sh |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 5ceb3e5..4312143 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -329,7 +329,8 @@ find_usable_blockdevices() {
 # most likely this is just some loop files, some /dev/mapper/arch_* files and maybe /dev/sr0
 # but in theory, could be anything
 dev_used_by_environment () {
-	local dev=$1
+	# first resolve any symlinks that may exist
+	local dev=$(readlink -f "$1")
 	grep -q "^$dev$" /run/aif/ignore_block_devices 2>/dev/null
 }
 
-- 
1.7.10.2



More information about the arch-releng mailing list