diff options
-rw-r--r-- | lib/cmd/install.sh | 42 | ||||
-rw-r--r-- | locale/en_US.sh | 3 |
2 files changed, 45 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 +} diff --git a/locale/en_US.sh b/locale/en_US.sh index 3d2946f..123c949 100644 --- a/locale/en_US.sh +++ b/locale/en_US.sh @@ -68,6 +68,9 @@ msg_prokit_cmd_install_chroot_dir_exists='Directory "%s" exists"' msg_prokit_cmd_install_mkdir_chroot_fail='Failed to create directory "%s"' msg_prokit_cmd_install_find_pkgs='Configuring opkg and retrieving Packages '\ 'files...' +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...' # lib/profile.sh msg_prokit_profile_not_found='Profile "%s" not found' |