Patchwork mkefidisk.sh: Allow symlink for device

login
register
mail settings
Submitter Darren Hart
Date June 23, 2014, 9:44 p.m.
Message ID <9b67e808e9115abc08321cd3dd3d38a74e6f41c0.1403559881.git.dvhart@linux.intel.com>
Download mbox | patch
Permalink /patch/74277/
State Accepted
Commit d3408652849cd62f8e95757b92d755e8931c7d2c
Headers show

Comments

Darren Hart - June 23, 2014, 9:44 p.m.
Allow the user to specify a symlink as the host device. If a link is
used, mkefidisk will now dereference it and use the link target when
looking for sysfs information.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 scripts/contrib/mkefidisk.sh | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index c86849d..1992d6c 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -98,6 +98,11 @@  DEVICE=$1
 HDDIMG=$2
 TARGET_DEVICE=$3
 
+LINK=$(readlink $DEVICE)
+if [ $? -eq 0 ]; then
+	DEVICE="$LINK"
+fi
+
 if [ ! -w "$DEVICE" ]; then
 	echo "ERROR: Device $DEVICE does not exist or is not writable"
 	usage