Skip to content

Commit

Permalink
fixed mkbootable not unmounting disks correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gkovacs committed Jul 18, 2017
1 parent 9759a66 commit 8ca8d67
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/unetbootin/unetbootin.app/Contents/Resources/mkbootable
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ echo "arg should contain /dev/ e.g. /dev/disk2s1"
syslinuxcmd=`echo "$0" | sed s/mkbootable/syslinux-mac/g`
echo "syslinuxcmd: $syslinuxcmd $1"
"$syslinuxcmd" "$1"
sync
diskutil umountDisk force "$1"
sync

sync # flush to disk before forced unmount
diskutil unmount "$1"
diskutil unmountDisk force "$1"

rawdev=`echo "$1" | sed "s/s[^s]*$//"`
partnum=`echo "$1" | perl -l -ne '/s[0-9]+(?!.*s)/ && print $&' | perl -l -ne '/[0-9]+/ && print $&'`
rawdevrdisk=`echo "$rawdev" | sed s/disk/rdisk/`
Expand All @@ -28,8 +30,9 @@ dd conv=notrunc bs=440 count=1 if="$mbrfile" of="$rawdev"
echo "2 passed fdisk quit"
sync
echo "passed writing mbr"
diskutil umountDisk force "$1" # stw it may have got auto mounted after dd
sleep .5 # Waits 0.5 second.
sync
diskutil unmount "$1"
diskutil unmountDisk force "$1" # stw it may have got auto mounted after dd

fdisk -y -e "$rawdev" << EOR
flag $partnum
Expand Down

0 comments on commit 8ca8d67

Please sign in to comment.