2022-06-03 21:45:00 -07:00
|
|
|
#!/bin/bash -x
|
2022-03-26 12:42:40 -07:00
|
|
|
|
|
|
|
# Sort these packages by name and split on commas.
|
|
|
|
function normalize_package_list {
|
2022-06-03 21:45:00 -07:00
|
|
|
stripped="$(echo \"${1}\" | sed 's/,//g')"
|
2022-03-26 12:42:40 -07:00
|
|
|
# Remove extraneous spaces at the middle, beginning, and end.
|
|
|
|
trimmed="$(echo \"${stripped}\" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')"
|
2022-06-03 21:45:00 -07:00
|
|
|
echo "${trimmed}" | sort
|
2022-03-26 12:42:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Split fully qualified package into name and version
|
|
|
|
function get_package_name_ver {
|
2022-06-03 21:45:00 -07:00
|
|
|
IFS=\= read name ver <<< "${1}"
|
2022-03-26 12:42:40 -07:00
|
|
|
# If version not found in the fully qualified package value.
|
|
|
|
if test -z "${ver}"; then
|
|
|
|
ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')"
|
|
|
|
fi
|
|
|
|
echo 'package_name="${name}"; package_ver="${ver}"'
|
|
|
|
}
|