Skip to content

Commit

Permalink
src/winusb: Split mount_source_and_target_filesystem to separate func…
Browse files Browse the repository at this point in the history
…tions

Signed-off-by: 林博仁 <[email protected]>
  • Loading branch information
brlin-tw committed Jun 8, 2017
1 parent 9e4370f commit 301db2b
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/winusb
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,19 @@ init(){

current_state="start-mounting"

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

if ! mount_target_filesystem\
"${target_partition}"\
"${target_fs_mountpoint}"\
|| exit 1
"${target_fs_mountpoint}"; then
echo_with_color red "Error: Unable to mount target filesystem"
exit 1
fi

check_target_filesystem_free_space\
"${target_fs_mountpoint}"\
Expand Down Expand Up @@ -616,15 +623,12 @@ check_target_filesystem(){
return 0
}; declare -fr check_target_filesystem

mount_source_and_target_filesystem(){
util_check_function_parameters_quantity 4 "${#}"

mount_source_filesystem(){
util_check_function_parameters_quantity 2 $#
local source_media="$1"; shift
local source_fs_mountpoint="$1"; shift
local target_partition="$1"; shift
local target_fs_mountpoint="$1"
local source_fs_mountpoint="$1"

echo_with_color green "Mounting source and target filesystems..."
echo_with_color green "Mounting source filesystem..."

mkdir\
--parents\
Expand Down Expand Up @@ -653,6 +657,12 @@ mount_source_and_target_filesystem(){
return 1
)
fi
}; declare -fr mount_source_filesystem

mount_target_filesystem(){
util_check_function_parameters_quantity 2 $#
local target_partition="$1"; shift
local target_fs_mountpoint="$1"

mkdir\
--parents\
Expand All @@ -668,7 +678,7 @@ mount_source_and_target_filesystem(){
echo_with_color red "${FUNCNAME[0]}: Error: Unable to mount target partition"
return 1
)
}; declare -fr mount_source_and_target_filesystem
}; declare -fr mount_target_filesystem

check_target_filesystem_free_space(){
util_check_function_parameters_quantity 2 $#
Expand Down

0 comments on commit 301db2b

Please sign in to comment.