Fix lib arg ref and quoting behavior.

This commit is contained in:
awalsh128 2022-06-30 00:51:24 -07:00
parent 1ca2ac1a4c
commit c961be0ea5
2 changed files with 6 additions and 6 deletions

8
lib.sh
View file

@ -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}')"

View file

@ -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}"