summaryrefslogtreecommitdiffstats
path: root/src/feed.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-04-16 22:03:40 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-04-16 22:13:39 (EDT)
commit05ed65eed03a70b318effe0915508ea27ba64b71 (patch)
treea5e0634678edde3d529a82c3b367ffcb7ed87f3d /src/feed.sh
parent2db34bc5f78c74d8b371e836ed8dc32217eaee3a (diff)
feed_download_cert(): New function
Diffstat (limited to 'src/feed.sh')
-rw-r--r--src/feed.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/feed.sh b/src/feed.sh
index 7e4a19b..db53f57 100644
--- a/src/feed.sh
+++ b/src/feed.sh
@@ -52,6 +52,48 @@ feed_download()
return 0
}
+feed_download_cert()
+{
+ local base_url="${1}"
+ local list_file="${2}"
+ local use_gzip="${3}"
+ local url=
+ local usign=
+
+ if ${use_gzip}; then
+ url="${base_url}/Packages.gz"
+ # Don't bother with gunzip, because only opkg-lede after storing
+ # compressed package lists (commit cd113c7) supports signature
+ # checking with usign (commit 71f02a3).
+ else
+ url="${base_url}/Packages"
+ fi
+
+ if ! ${WGET} -q -O "${list_file}.tmp" "${url}"; then
+ return 1
+ fi
+ if ! ${WGET} -q -O "${list_file}.sig" "${base_url}/Packages.sig"; then
+ rm -f "${list_file}.tmp"
+ return 1
+ fi
+
+ if ${in_place} && ${USIGN_EMBEDDED}; then
+ usign="${builddir}/3rdparty/usign/usign"
+ else
+ usign="${USIGN}"
+ fi
+
+ if ! ROOT="${root}" TMPDIR="${root}/tmp" USIGN="${usign}" \
+ WGET="${WGET}" GUNZIP="${GUNZIP}" "${OPKG_CERT}" \
+ verify "${list_file}.sig" "${list_file}.tmp"; then
+ rm -f "${list_file}.tmp" "${list_file}.sig"
+ return 1
+ fi
+ mv "${list_file}.tmp" "${list_file}"
+
+ return 0
+}
+
feed_find_pkgs()
{
local feed_idx="${1}"