summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-17 15:33:50 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-17 15:33:50 (EST)
commit9add17a7f4a24fe04a7a93782e51ce710d7e371e (patch)
tree552bd49f1d7337cf13e9ed4778abd0dd42f159ee
parent86080f13a07435ff860cd239ed614434b1f42b56 (diff)
install_get_pkgs(): Use non-exiting error()
Also improve error handling.
-rw-r--r--src/install.sh38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/install.sh b/src/install.sh
index da786bd..8447dcc 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -195,6 +195,7 @@ install_get_pkgs()
{
local root="${1}"
local status_fd=
+ local errors=
local pkg=
local url=
local md5sum=
@@ -213,6 +214,8 @@ install_get_pkgs()
fi
status_fd=${FD}
+ errors=false
+
for pkg in $(cat "${root}/.prokit/packages"); do
info "$(get_msg 'install_downloading_pkg')" "${pkg}"
url="$(printf '%s\n' "${install_urls}" | \
@@ -222,19 +225,28 @@ install_get_pkgs()
sha256sum="$(printf '%s\n' "${install_sha256sums}" | \
sed -n "s/^${pkg} //p")"
fname="var/cache/opkg/archives/${url##*/}"
- ${WGET} -q -O "${root}/${fname}" "${url}" || \
- error 2 "$(get_msg 'install_downloading_pkg_fail')"
+ if ! ${WGET} -q -O "${root}/${fname}" "${url}"; then
+ error "$(get_msg 'install_downloading_pkg_fail')"
+ errors=true
+ continue
+ fi
if [ "x${md5sum}" != 'x' ]; then
- printf '%s %s\n' \
- "${md5sum}" "${root}/${fname}" | \
- md5sum -c >/dev/null 2>&1 || \
- error 2 "$(get_msg 'install_checksum_fail')"
+ if ! printf '%s %s\n' \
+ "${md5sum}" "${root}/${fname}" | \
+ md5sum -c >/dev/null 2>&1; then
+ error "$(get_msg 'install_checksum_fail')"
+ errors=true
+ continue
+ fi
fi
if [ "x${sha256sum}" != 'x' ]; then
- printf '%s %s\n' \
- "${sha256sum}" "${root}/${fname}" | \
- ${SHA256SUM} -c >/dev/null 2>&1 || \
- error 2 "$(get_msg 'install_checksum_fail')"
+ if ! printf '%s %s\n' \
+ "${sha256sum}" "${root}/${fname}" | \
+ ${SHA256SUM} -c >/dev/null 2>&1; then
+ error "$(get_msg 'install_checksum_fail')"
+ errors=true
+ continue
+ fi
fi
info "$(get_msg 'install_unpacking_pkg')" "${pkg}"
@@ -288,5 +300,9 @@ install_get_pkgs()
fclose ${status_fd}
- return 0
+ if ! ${errors}; then
+ return 0
+ else
+ return 1
+ fi
}