summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-07-07 20:02:01 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-07-07 20:02:01 (EDT)
commitcea005ff55af6d012f2b2c99263adb29da6d3a72 (patch)
treead5b3ce333585200f1bc9bb7347386266a8c1b12
parent7f51f0e82f6f808f01f515a8db80fb28be1bac74 (diff)
Revert "install: Replace sed "arrays" with eval "arrays""
This reverts commit 7f51f0e82f6f808f01f515a8db80fb28be1bac74.
-rw-r--r--src/install.sh34
1 files changed, 18 insertions, 16 deletions
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 @@
# <http://www.gnu.org/licenses/>.
_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')"