Skip to content

Commit

Permalink
Added file system check
Browse files Browse the repository at this point in the history
  • Loading branch information
meefik committed May 15, 2017
1 parent 3fc1cd5 commit ecddfee
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
################################################################################

VERSION="2.1.4"
VERSION="2.1.5"

################################################################################
# Common
Expand Down Expand Up @@ -554,21 +554,21 @@ 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}"
fs_check()
{
if is_mounted "${CHROOT_DIR}"; then
return 1
fi
if [ -z "$(which e2fsck)" ]; then
return 1
fi
case "${TARGET_TYPE}" in
file|partition)
e2fsck -p "${TARGET_PATH}" 1>&2
return 0
;;
partition)
e2fsck -p "${TARGET_PATH}"
esac
return 0
return 1
}
mount_part()
Expand Down Expand Up @@ -704,10 +704,12 @@ container_mount()
return $?
fi
fs_check
params_check TARGET_PATH || return 1
msg -n "Checking file system ... "
fs_check
is_ok "skip" "done"
msg "Mounting partitions: "
local item
for item in $*
Expand Down

0 comments on commit ecddfee

Please sign in to comment.