From 686ae5cbb1a074a8a2968d11b0c31fb16fc1c023 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 30 Jun 2022 01:27:20 -0700 Subject: [PATCH] Fix package enumeration. --- install_and_cache_pkgs.sh | 10 +++++----- pre_cache_action.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install_and_cache_pkgs.sh b/install_and_cache_pkgs.sh index f3cdfe5..81096ed 100755 --- a/install_and_cache_pkgs.sh +++ b/install_and_cache_pkgs.sh @@ -14,12 +14,12 @@ cache_dir="${1}" input_packages="${@:2}" # Trim commas, excess spaces, and sort. -packages="$(normalize_package_list "${input_packages}")" +normalized_packages="$(normalize_package_list "${input_packages}")" -package_count=$(echo "${packages}" | wc -w) +package_count=$(echo "${normalized_packages}" | wc -w) echo "Clean installing and caching ${package_count} package(s)." echo "Package list:" -for package in "${packages}"; do +for package in ${normalized_packages}; do echo "- ${package}" done @@ -29,8 +29,8 @@ echo "done." manifest="" echo "Clean installing and caching ${package_count} packages..." -for package in "${packages}"; do - get_package_name_ver "${package}" # -> package_name, package_ver +for package in ${normalized_packages}; do + read package_name package_ver < <(get_package_name_ver "${package}") package_deps="$(apt-get install --dry-run --yes "${package_name}" | grep "^Inst" | awk '{print $2}')" echo "- ${package_name}" diff --git a/pre_cache_action.sh b/pre_cache_action.sh index 2f26954..ec33dae 100755 --- a/pre_cache_action.sh +++ b/pre_cache_action.sh @@ -42,7 +42,7 @@ for package in ${packages}; do echo "Package '${package}' not found." >&2 exit 3 fi - read package_name package_ver < <(get_package_name_ver "${package}") # -> package_name, package_ver + read package_name package_ver < <(get_package_name_ver "${package}") versioned_packages=""${versioned_packages}" "${package_name}"="${package_ver}"" done echo "done."