From 7a6aaf0850400e61c60281cf15386d8f5ad3cb40 Mon Sep 17 00:00:00 2001 From: illiliti Date: Tue, 11 May 2021 12:37:45 +0300 Subject: [PATCH] device-helper: avoid redundant blkid call --- device-helper | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device-helper b/device-helper index 993cdd2..6d4c431 100755 --- a/device-helper +++ b/device-helper @@ -29,7 +29,7 @@ command -v blkid || exit 0 # Race condition may occur if uevent arrives faster(isn't that a kernel bug!?) # than the kernel initializes device. This prevents blkid to fetch data from # device. To fix this, we simply waiting until blkid is succeeded. -while ! blkid "/dev/${dev_name}"; do +while ! _blkid=$(blkid "/dev/${dev_name}"); do if [ "$((count += 1))" = 30 ]; then exit 1 else @@ -37,7 +37,7 @@ while ! blkid "/dev/${dev_name}"; do fi done -for line in $(blkid "/dev/${dev_name}"); do case "${line%%=*}" in +for line in $_blkid; do case "${line%%=*}" in UUID) create_symlink /dev/disk/by-uuid "${line##*=}" ;; LABEL) create_symlink /dev/disk/by-label "${line##*=}" ;; PARTUUID) create_symlink /dev/disk/by-partuuid "${line##*=}" ;;