Move scripts to bin/ directory
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# mounts a windows VHD in wsl
|
||||
APP_DIR="$(dirname "$0")"
|
||||
WINDOWS_MOUNT="$APP_DIR/windows-mount"
|
||||
WSL_PATH="$APP_DIR/wsl-path"
|
||||
WSL_INTEROP_READY="$APP_DIR/wsl-interop-ready"
|
||||
SLEEP_INTERVAL=0.5
|
||||
|
||||
DRIVE="$1"
|
||||
DISK_LABEL="$2"
|
||||
DISK_PATH="/dev/disk/by-label/$DISK_LABEL"
|
||||
|
||||
if ! $WINDOWS_MOUNT >/dev/null; then
|
||||
echo "Error: Windows not mounted" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! $WSL_INTEROP_READY; then
|
||||
echo "Error: WSL Interop not ready" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WSL="$($WSL_PATH)"
|
||||
if ! [ -e "$DISK_PATH" ]; then
|
||||
$WSL --mount --bare --vhd "$DRIVE"
|
||||
|
||||
# poll until the block device node appears or task times out
|
||||
until [ -L "$DISK_PATH" ] && [ -b "$DISK_PATH" ]; do
|
||||
sleep "$SLEEP_INTERVAL"
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user