From cea005ff55af6d012f2b2c99263adb29da6d3a72 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 07 Jul 2020 20:02:01 -0400 Subject: Revert "install: Replace sed "arrays" with eval "arrays"" This reverts commit 7f51f0e82f6f808f01f515a8db80fb28be1bac74. --- (limited to 'src/install.sh') diff --git a/src/install.sh b/src/install.sh index 6f727ea..ab2977b 100644 --- a/src/install.sh +++ b/src/install.sh @@ -19,6 +19,9 @@ # . _install_deps= +_install_urls= +_install_md5sums= +_install_sha256sums= _install_feed_url= _usign_fingerprint() @@ -59,10 +62,9 @@ _install_fname_cb() local pkg="${1}" local fname="${2}" shift 2 - local pkg_clean= - pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" - eval "_install_url_${pkg_clean}=\"\${_install_feed_url}/\${fname}\"" + _install_urls="$(printf '%s\n%s %s/%s' "${_install_urls}" \ + "${pkg}" "${_install_feed_url}" "${fname}")" return 0 } @@ -72,10 +74,9 @@ _install_md5sum_cb() local pkg="${1}" local md5sum="${2}" shift 2 - local pkg_clean= - pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" - eval "_install_md5sum_${pkg_clean}=\"\${md5sum}\"" + _install_md5sums="$(printf '%s\n%s %s' "${_install_md5sums}" \ + "${pkg}" "${md5sum}")" return 0 } @@ -85,10 +86,9 @@ _install_sha256sum_cb() local pkg="${1}" local sha256sum="${2}" shift 2 - local pkg_clean= - pkg_clean="$(printf '%s' "${pkg}" | tr -C 'A-Za-z0-9' '_')" - eval "_install_sha256sum_${pkg_clean}=\"\${sha256sum}\"" + _install_sha256sums="$(printf '%s\n%s %s' \ + "${_install_sha256sums}" "${pkg}" "${sha256sum}")" return 0 } @@ -120,6 +120,9 @@ install_find_pkgs() opkg_conf_fd=${FD} _install_deps= + _install_urls= + _install_md5sums= + _install_sha256sums= if ! fopen "${root}/.prokit/packages" 'w'; then return 1 @@ -194,7 +197,6 @@ install_get_pkgs() local status_fd= local errors= local pkg= - local pkg_clean= local url= local md5sum= local sha256sum= @@ -216,12 +218,12 @@ install_get_pkgs() for pkg in $(cat -- "${root}/.prokit/packages"); do info "$(get_msg 'install_downloading_pkg')" "${pkg}" - 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}}\"")" + 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")" fname="var/cache/opkg/archives/${url##*/}" if ! ${WGET} -q -O "${root}/${fname}" -- "${url}"; then error "$(get_msg 'install_downloading_pkg_fail')" -- cgit v0.9.1