]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Support `/dev/disk/by-id/` symlinks in command-line installer (#1422)
authorjakoblell <jakob@jakoblell.com>
Sun, 6 Feb 2022 15:13:15 +0000 (16:13 +0100)
committerGitHub <noreply@github.com>
Sun, 6 Feb 2022 15:13:15 +0000 (23:13 +0800)
* Allow symlinks as target device (for supporting /dev/disk/by-id)

* Use correct test (-L) for checking if it is a symlink

Co-authored-by: Jakob Lell <jakob@srlabs.com>
INSTALL/tool/VentoyWorker.sh

index 9754e5ed5c01b9716b784425a854b1613d86a25f..cdb1dbb87f4f79c1033eac96e27ed2773c7f1717 100644 (file)
@@ -60,6 +60,12 @@ while [ -n "$1" ]; do
             exit 1
         fi
         DISK=$1
+        # Resolve symlinks now, will be needed to look up information about the device in
+        # the /sys/ filesystem, for example /sys/class/block/${DISK#/dev/}/start
+        # The main use case is supporting /dev/disk/by-id/ symlinks instead of raw devices
+        if [ -L "$DISK" ]; then
+            DISK=$(readlink -e -n "$DISK")
+        fi
     fi
     
     shift