summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/cmd/install.sh18
-rw-r--r--locale/en_US.sh1
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh
index 4483843..3bfdfa4 100644
--- a/lib/cmd/install.sh
+++ b/lib/cmd/install.sh
@@ -209,6 +209,8 @@ cmd_install_get_pkgs()
local status_fd=
local pkg=
local fname=
+ local md5sum=
+ local sha256sum=
local file=
local control=
local field=
@@ -224,10 +226,26 @@ cmd_install_get_pkgs()
info "$(get_msg 'cmd_install_downloading_pkg')" "${pkg}"
fname="$(printf '%s\n' "${cmd_install_fnames}" | \
sed -n "s/^${pkg} //p")"
+ md5sum="$(printf '%s\n' "${cmd_install_md5sums}" | \
+ sed -n "s/^${pkg} //p")"
+ sha256sum="$(printf '%s\n' "${cmd_install_sha256sums}" | \
+ sed -n "s/^${pkg} //p")"
wget -q -O "${chroot}/var/cache/opkg/archives/${fname##*/}" \
"${fname}" || \
error 2 "$(get_msg 'cmd_install_downloading_pkg_fail')"
fname="var/cache/opkg/archives/${fname##*/}"
+ if [ "x${md5sum}" != 'x' ]; then
+ printf '%s %s\n' \
+ "${md5sum}" "${chroot}/${fname}" | \
+ md5sum -c >/dev/null 2>&1 || \
+ error 2 "$(get_msg 'cmd_install_checksum_fail')"
+ fi
+ if [ "x${sha256sum}" != 'x' ]; then
+ printf '%s %s\n' \
+ "${sha256sum}" "${chroot}/${fname}" | \
+ sha256sum -c >/dev/null 2>&1 || \
+ error 2 "$(get_msg 'cmd_install_checksum_fail')"
+ fi
info "$(get_msg 'cmd_install_unpacking_pkg')" "${pkg}"
mkdir "${chroot}/tmp/opkg/${pkg}"
diff --git a/locale/en_US.sh b/locale/en_US.sh
index a8f1969..d39cf1b 100644
--- a/locale/en_US.sh
+++ b/locale/en_US.sh
@@ -72,6 +72,7 @@ msg_prokit_cmd_install_downloading_pkg='Downloading %s...'
msg_prokit_cmd_install_downloading_pkg_fail='Failed to download package'
msg_prokit_cmd_install_unpacking_pkg='Unpacking %s...'
msg_prokit_cmd_install_configuring='Configuring packages...'
+msg_prokit_cmd_install_checksum_fail='Checksum of package file failed'
# lib/cmd/shell.sh
msg_prokit_cmd_shell_summary='enter a ProteanOS shell'