aboutsummaryrefslogtreecommitdiffstats
path: root/dfly-update
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-03-10 23:43:10 +0800
committerAaron LI <aly@aaronly.me>2018-03-10 23:43:10 +0800
commitf25d2060f4ed63585b9aae49e35794a0cba3643a (patch)
treeac0aa1d364a3f605998482137c7b4d58d1914ffb /dfly-update
parent5ccc0757901419acc3b2decdac86ac133eb9647c (diff)
downloaddfly-update-f25d2060f4ed63585b9aae49e35794a0cba3643a.tar.bz2
Improve EC_NOFILE error a bit im checksum_image() and mount_image()
Diffstat (limited to 'dfly-update')
-rwxr-xr-xdfly-update19
1 files changed, 11 insertions, 8 deletions
diff --git a/dfly-update b/dfly-update
index e4666eb..9c8f171 100755
--- a/dfly-update
+++ b/dfly-update
@@ -267,7 +267,8 @@ checksum_image() {
local file="$1"
local md5_match="$2"
local md5
- [ -f "${file}" ] || error ${EC_NOFILE} "checksum_image: file not exists"
+ [ -f "${file}" ] || \
+ error ${EC_NOFILE} "checksum_image: file not exists: ${file}"
md5=$(md5 -q "${file}")
if [ "${md5}" = "${md5_match}" ]; then
return 0
@@ -642,20 +643,22 @@ cmd_download() {
# Mount the given image file
#
# usage:
-# cmd_mount <filepath>
+# cmd_mount <file>
cmd_mount() {
[ $# -eq 1 ] || \
error ${EC_ARGS} "cmd_mount: invalid arguments: $@"
- local filepath="$1"
- case "${filepath}" in
+ local file="$1"
+ [ -f "${file}" ] || \
+ error ${EC_NOFILE} "checksum_image: file not exists: ${file}"
+ case "${file}" in
*.bz2)
- echo -n "Decompressing file: ${filepath} ... "
- bunzip2 "${filepath}"
+ echo -n "Decompressing file: ${file} ... "
+ bunzip2 "${file}"
echo "DONE"
- filepath="${filepath%.bz2}"
+ filepath="${file%.bz2}"
;;
esac
- mount_image "${filepath}" "${MNT_DIR}"
+ mount_image "${file}" "${MNT_DIR}"
}
# Back up the current kernel and world