summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cmd/install.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh
index 88b6b0a..18368a5 100644
--- a/lib/cmd/install.sh
+++ b/lib/cmd/install.sh
@@ -92,6 +92,7 @@ cmd_install_main()
info "$(get_msg 'cmd_install_find_pkgs')"
cmd_install_find_pkgs "${mirror}" "${suite}" "${arch}" "${plat}" \
"${chroot}"
+ cmd_install_get_pkgs "${chroot}"
}
cmd_install_find_pkgs()
@@ -155,3 +156,44 @@ cmd_install_fname_cb()
cmd_install_fnames="$(printf '%s\n%s %s/%s' "${cmd_install_fnames}" \
"${pkg}" "${cmd_install_feed_url}" "${fname}")"
}
+
+cmd_install_get_pkgs()
+{
+ local chroot="${1}"
+ local pkg=
+ local fname=
+ local file=
+
+ mkdir -p "${chroot}/var/cache/opkg/archives" "${chroot}/tmp/opkg" \
+ "${chroot}/var/lib/opkg/info"
+
+ for pkg in $(cat "${chroot}/.prokit/packages"); do
+ info "$(get_msg 'cmd_install_downloading_pkg')" "${pkg}"
+ fname="$(printf '%s\n' "${cmd_install_fnames}" | \
+ 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##*/}"
+
+ info "$(get_msg 'cmd_install_unpacking_pkg')" "${pkg}"
+ mkdir "${chroot}/tmp/opkg/${pkg}"
+ (
+ cd "${chroot}"
+ tar -xzOf "${fname}" data.tar.gz \
+ >"tmp/opkg/${pkg}/data.tar.gz"
+ tar -xzf "tmp/opkg/${pkg}/data.tar.gz"
+ cd "tmp/opkg/${pkg}"
+ tar -xzOf "../../../${fname}" control.tar.gz | \
+ tar -xz
+ )
+ tar -tzf "${chroot}/tmp/opkg/${pkg}/data.tar.gz" | sed 's/^\.//' \
+ >"${chroot}/var/lib/opkg/info/${pkg}.list"
+ rm -f "${chroot}/tmp/opkg/${pkg}/data.tar.gz"
+ for file in "${chroot}/tmp/opkg/${pkg}/"*; do
+ mv "${file}" \
+ "${chroot}/var/lib/opkg/info/${pkg}.${file##*/}"
+ done
+ rmdir "${chroot}/tmp/opkg/${pkg}"
+ done
+}