From c961be0ea58da1e5eb6b11e28e22fd1f83665613 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 30 Jun 2022 00:51:24 -0700 Subject: [PATCH] Fix lib arg ref and quoting behavior. --- lib.sh | 8 ++++---- pre_cache_action.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib.sh b/lib.sh index 2a31aac..a8011a2 100755 --- a/lib.sh +++ b/lib.sh @@ -2,15 +2,15 @@ # Sort these packages by name and split on commas. function normalize_package_list { - stripped="$(echo \"${0}\" | sed 's/,//g')" + stripped=$(echo "${1}" | sed 's/,//g') # Remove extraneous spaces at the middle, beginning, and end. - trimmed="$(echo \"${stripped}\" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" - echo "$(\"${trimmed}\" | sort)" + trimmed="$(echo "${stripped}" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" + echo "$(echo "${trimmed}" | sort)" } # Split fully qualified package into name and version function get_package_name_ver { - IFS=\= read name ver <<< "${0}" + IFS=\= read name ver <<< "${1}" # If version not found in the fully qualified package value. if test -z "${ver}"; then ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')" diff --git a/pre_cache_action.sh b/pre_cache_action.sh index 4bd63d4..1b0c70c 100755 --- a/pre_cache_action.sh +++ b/pre_cache_action.sh @@ -5,10 +5,10 @@ script_dir="$(dirname -- "$(realpath -- "${0}")")" source "${script_dir}/lib.sh" # Directory that holds the cached packages. -cache_dir=${1} +cache_dir="${1}" # Version of the cache to create or load. -version=${2} +version="${2}" # List of the packages to use. input_packages="${@:3}"