Skip to content

Commit 34efcc2

Browse files
committed
Adapt for macOS
1 parent cec86e9 commit 34efcc2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

format-udf.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ KERNEL_NAME=$(uname -s)
322322
if [[ "$KERNEL_NAME" = "Linux" ]]; then
323323
KDEVICE_PATH=$(readlink -f "$DEVICE_PATH")
324324
elif [[ "$KERNEL_NAME" = "Darwin" ]]; then
325-
KDEVICE_PATH=$(readlink "$DEVICE_PATH")
325+
KDEVICE_PATH=$(readlink "$DEVICE_PATH") || true
326+
if [[ -z "$KDEVICE_PATH" ]]; then
327+
KDEVICE_PATH=$DEVICE_PATH
328+
fi
326329
else
327330
echo "[-] Internal error 1" >&2
328331
exit 1
@@ -480,7 +483,7 @@ else
480483
fi
481484

482485
# is user attempting to format part?
483-
if [[ "${IS_WHOLE,,}" = "no" ]]; then
486+
if [[ $(echo "$IS_WHOLE" | tr '[:upper:]' '[:lower:]') != "yes" ]]; then
484487
if [[ "$PARTITION_TYPE" != "none" ]]; then
485488
echo "[-] You are attempting to format a single partition (as opposed to entire device)." >&2
486489
echo "[-] Partition type '$PARTITION_TYPE' incompatible with single partition formatting." >&2

0 commit comments

Comments
 (0)