diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cmd/install.sh | 18 |
1 files changed, 18 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}" |