Skip to content

Commit

Permalink
Merge pull request #785 from Jerry981028/cli
Browse files Browse the repository at this point in the history
Add fsck in cli.sh
  • Loading branch information
meefik authored May 15, 2017
2 parents 5e7ad46 + cb75a10 commit 3fc1cd5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,23 @@ container_mounted()
fi
}
fs_check(){
is_mounted "${CHROOT_DIR}" && return 0
case "$TARGET_TYPE" in
file)
local loop_device
loop_device="$(losetup -f 2>&1 |grep -o -E '/dev/.*loop[0-9]+')"
[ -z "$loop_device" ] && return 0
losetup "${loop_device}" "${TARGET_PATH}"
e2fsck -p "${loop_device}"
losetup -d "${loop_device}"
;;
partition)
e2fsck -p "${TARGET_PATH}"
esac
return 0
}
mount_part()
{
case "$1" in
Expand Down Expand Up @@ -687,6 +704,8 @@ container_mount()
return $?
fi
fs_check
params_check TARGET_PATH || return 1
msg "Mounting partitions: "
Expand Down

0 comments on commit 3fc1cd5

Please sign in to comment.