mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
test: check if all paths passed to helper_check_device_symlinks() are valid
This commit is contained in:
@@ -11,10 +11,18 @@ helper_check_device_symlinks() {
|
||||
# when leaving the function)
|
||||
set +x; trap "trap - RETURN; set -x" RETURN
|
||||
|
||||
local dev link paths target
|
||||
local dev link path paths target
|
||||
|
||||
[[ $# -gt 0 ]] && paths=("$@") || paths=("/dev/disk")
|
||||
|
||||
# Check if all given paths are valid
|
||||
for path in "${paths[@]}"; do
|
||||
if ! test -e "$path"; then
|
||||
echo >&2 "Path '$path' doesn't exist"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
while read -r link; do
|
||||
target="$(readlink -f "$link")"
|
||||
echo "$link -> $target"
|
||||
|
||||
Reference in New Issue
Block a user