diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/install.sh | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/install.sh b/src/install.sh index ab2977b..6f727ea 100644 --- a/src/install.sh +++ b/src/install.sh @@ -19,9 +19,6 @@ # <http://www.gnu.org/licenses/>. _install_deps= -_install_urls= -_install_md5sums= -_install_sha256sums= _install_feed_url= _usign_fingerprint() @@ -62,9 +59,10 @@ _install_fname_cb() local pkg="${1}" local fname="${2}" shift 2 + local pkg_clean= - _install_urls="$(printf '%s\n%s %s/%s' "${_install_urls}" \ - "${pkg}" "${_install_feed_url}" "${fname}")" + pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" + eval "_install_url_${pkg_clean}=\"\${_install_feed_url}/\${fname}\"" return 0 } @@ -74,9 +72,10 @@ _install_md5sum_cb() local pkg="${1}" local md5sum="${2}" shift 2 + local pkg_clean= - _install_md5sums="$(printf '%s\n%s %s' "${_install_md5sums}" \ - "${pkg}" "${md5sum}")" + pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" + eval "_install_md5sum_${pkg_clean}=\"\${md5sum}\"" return 0 } @@ -86,9 +85,10 @@ _install_sha256sum_cb() local pkg="${1}" local sha256sum="${2}" shift 2 + local pkg_clean= - _install_sha256sums="$(printf '%s\n%s %s' \ - "${_install_sha256sums}" "${pkg}" "${sha256sum}")" + pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" + eval "_install_sha256sum_${pkg_clean}=\"\${sha256sum}\"" return 0 } @@ -120,9 +120,6 @@ install_find_pkgs() opkg_conf_fd=${FD} _install_deps= - _install_urls= - _install_md5sums= - _install_sha256sums= if ! fopen "${root}/.prokit/packages" 'w'; then return 1 @@ -197,6 +194,7 @@ install_get_pkgs() local status_fd= local errors= local pkg= + local pkg_clean= local url= local md5sum= local sha256sum= @@ -218,12 +216,12 @@ install_get_pkgs() for pkg in $(cat -- "${root}/.prokit/packages"); do info "$(get_msg 'install_downloading_pkg')" "${pkg}" - url="$(printf '%s\n' "${_install_urls}" | \ - sed -n "s/^${pkg} //p")" - md5sum="$(printf '%s\n' "${_install_md5sums}" | \ - sed -n "s/^${pkg} //p")" - sha256sum="$(printf '%s\n' "${_install_sha256sums}" | \ - sed -n "s/^${pkg} //p")" + pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" + url="$(eval "printf '%s' \"\${_install_url_${pkg_clean}}\"")" + md5sum="$(eval "printf '%s' \ + \"\${_install_md5sum_${pkg_clean}}\"")" + sha256sum="$(eval "printf '%s' \ + \"\${_install_sha256sum_${pkg_clean}}\"")" fname="var/cache/opkg/archives/${url##*/}" if ! ${WGET} -q -O "${root}/${fname}" -- "${url}"; then error "$(get_msg 'install_downloading_pkg_fail')" |