diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-08-22 10:43:26 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-08-22 10:43:26 (EDT) |
commit | 2f2fa67818ac18d146852ebb9d40cb7eda8c16e3 (patch) | |
tree | 959bfcc1e6d07f643140544692b0102afef8a4ac | |
parent | 7f08f8318c1eaac40fc3606eeb13956f17bfb08a (diff) |
Collect package checksums
-rw-r--r-- | lib/cmd/install.sh | 26 | ||||
-rw-r--r-- | lib/feed.sh | 11 |
2 files changed, 36 insertions, 1 deletions
diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh index 2605831..4483843 100644 --- a/lib/cmd/install.sh +++ b/lib/cmd/install.sh @@ -26,6 +26,8 @@ use pkg cmd_install_optstring='a:P:m:F' cmd_install_deps= cmd_install_fnames= +cmd_install_md5sums= +cmd_install_sha256sums= cmd_install_feed_url= cmd_install_main() @@ -130,6 +132,8 @@ cmd_install_find_pkgs() cmd_install_deps= cmd_install_fnames= + cmd_install_md5sums= + cmd_install_sha256sums= fopen "${chroot}/.prokit/packages" 'w' pkgs_fd=${FD} @@ -147,7 +151,9 @@ cmd_install_find_pkgs() cmd_install_feed_url="${feed%/*}" feed_find_pkgs "${chroot}/var/lib/opkg/lists/${feed_idx}" \ "$(profile_dep_fields)" profile_include_pkg \ - cmd_install_deps_cb cmd_install_fname_cb >&${pkgs_fd} + cmd_install_deps_cb cmd_install_fname_cb \ + cmd_install_md5sum_cb cmd_install_sha256sum_cb \ + >&${pkgs_fd} done <<-EOF $(profile_feeds "${mirror}" "${arch}" "${plat}" "${suite}") EOF @@ -179,6 +185,24 @@ cmd_install_fname_cb() "${pkg}" "${cmd_install_feed_url}" "${fname}")" } +cmd_install_md5sum_cb() +{ + local pkg="${1}" + local md5sum="${2}" + + cmd_install_md5sums="$(printf '%s\n%s %s' "${cmd_install_md5sums}" \ + "${pkg}" "${md5sum}")" +} + +cmd_install_sha256sum_cb() +{ + local pkg="${1}" + local sha256sum="${2}" + + cmd_install_sha256sums="$(printf '%s\n%s %s' \ + "${cmd_install_sha256sums}" "${pkg}" "${sha256sum}")" +} + cmd_install_get_pkgs() { local chroot="${1}" diff --git a/lib/feed.sh b/lib/feed.sh index 87009da..3805bf0 100644 --- a/lib/feed.sh +++ b/lib/feed.sh @@ -27,6 +27,8 @@ feed_dep_fields= feed_pkg_cb= feed_deps_cb= feed_fname_cb= +feed_md5sum_cb= +feed_sha256sum_cb= feed_pkgs= feed_pkg_include= feed_pkg= @@ -56,11 +58,15 @@ feed_find_pkgs() local pkg_cb="${3}" local deps_cb="${4}" local fname_cb="${5}" + local md5sum_cb="${6}" + local sha256sum_cb="${7}" feed_dep_fields=" $(printf '%s ' ${dep_fields})" feed_pkg_cb="${pkg_cb}" feed_deps_cb="${deps_cb}" feed_fname_cb="${fname_cb}" + feed_md5sum_cb="${md5sum_cb}" + feed_sha256sum_cb="${sha256sum_cb}" feed_pkgs='' feed_pkg_include='false' @@ -79,10 +85,15 @@ feed_field_cb() local name="${1}" local value="${2}" + # TODO: These field name checks should be case insensitive. if [ "x${name}" = 'xPackage' ]; then feed_pkg="${value}" elif [ "x${name}" = 'xFilename' ]; then ${feed_fname_cb} "${feed_pkg}" "${value}" + elif [ "x${name}" = 'xMD5sum' ]; then + ${feed_md5sum_cb} "${feed_pkg}" "${value}" + elif [ "x${name}" = 'xSHA256sum' ]; then + ${feed_sha256sum_cb} "${feed_pkg}" "${value}" elif [ "x${feed_dep_fields#* ${name} }" != "x${feed_dep_fields}" ]; then feed_deps="${feed_deps}${value}, " fi |