Skip to content

Commit

Permalink
src/woeusb: Check source filesystem before we even touch the target d…
Browse files Browse the repository at this point in the history
…evice

Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
  • Loading branch information
brlin-tw committed May 8, 2018
1 parent 6fb1ee1 commit 28890ca
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/woeusb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,22 @@ init(){
"${target_device}"\
"${target_partition}"

current_state=mount-source-filesystem

if ! mount_source_filesystem\
"${source_media}"\
"${source_fs_mountpoint}"; then
echo_with_color red 'Error: Unable to mount source filesystem'
exit 1
fi

if [ "${target_filesystem_type}" == 'FAT' ]; then
if ! check_fat32_filesize_limitation\
"${source_fs_mountpoint}"; then
exit 1
fi
fi

if [ "${install_mode}" = 'device' ]; then
wipe_existing_partition_table_and_filesystem_signatures\
"${target_device}"
Expand Down Expand Up @@ -263,21 +279,7 @@ init(){
"${target_device}"
fi

current_state='start-mounting'

if ! mount_source_filesystem\
"${source_media}"\
"${source_fs_mountpoint}"; then
echo_with_color red 'Error: Unable to mount source filesystem'
exit 1
fi

if [ "${target_filesystem_type}" == 'FAT' ]; then
if ! check_fat32_filesize_limitation\
"${source_fs_mountpoint}"; then
exit 1
fi
fi
current_state=mount-target-filesystem

if ! mount_target_filesystem\
"${target_partition}"\
Expand Down

0 comments on commit 28890ca

Please sign in to comment.