aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-03-10 20:25:42 +0800
committerAaron LI <aly@aaronly.me>2018-03-10 20:41:29 +0800
commit169c3247525e9a448fd1f87c2139577fe02acb72 (patch)
treec460cc0ee24ccd125e4e9b46891ba32499a677cf
parent161009d4c6ff4be7c287fad5ea344f9bf756c499 (diff)
downloaddfly-update-169c3247525e9a448fd1f87c2139577fe02acb72.tar.bz2
Add error code EC_FETCH for fetch
-rwxr-xr-xdfly-update7
1 files changed, 5 insertions, 2 deletions
diff --git a/dfly-update b/dfly-update
index e54dba7..561adc0 100755
--- a/dfly-update
+++ b/dfly-update
@@ -25,6 +25,7 @@ EC_OS=10
EC_TMPFILE=11
EC_MD5=12
EC_ARGS=13
+EC_FETCH=14
#
@@ -162,7 +163,7 @@ get_latest_image() {
local tmpchecksum=$(mktemp -t ${NAME}) || exit ${EC_TMPFILE}
local latest_filename latest_md5 line
echo "Fetch remote systems checksum: ${url_checksum}" >&2
- fetch -q -o ${tmpchecksum} "${url_checksum}"
+ fetch -q -o ${tmpchecksum} "${url_checksum}" || exit ${EC_FETCH}
if is_master_branch "${branch}"; then
line=$(fgrep '.img.bz2' ${tmpchecksum} | tail -n 1)
else
@@ -246,7 +247,9 @@ download_image() {
echo " => ${outfile}"
fetch -o "${outfile}" "${url}" \
&& echo "DONE" \
- || exit $?
+ || exit ${EC_FETCH}
+}
+
}