mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2024-12-22 18:55:30 +00:00
Fix arg ordinals and package sort return.
This commit is contained in:
parent
9568dc9783
commit
49b4515f51
12
lib.sh
Normal file → Executable file
12
lib.sh
Normal file → Executable file
|
@ -1,23 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -x
|
||||||
|
|
||||||
# Sort these packages by name and split on commas.
|
# Sort these packages by name and split on commas.
|
||||||
function normalize_package_list {
|
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.
|
# Remove extraneous spaces at the middle, beginning, and end.
|
||||||
trimmed="$(echo \"${stripped}\" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')"
|
trimmed="$(echo \"${stripped}\" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')"
|
||||||
echo "$(\"${trimmed}\" | sort)"
|
echo "${trimmed}" | sort
|
||||||
}
|
}
|
||||||
|
|
||||||
# Split fully qualified package into name and version
|
# Split fully qualified package into name and version
|
||||||
function get_package_name_ver {
|
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 version not found in the fully qualified package value.
|
||||||
if test -z "${ver}"; then
|
if test -z "${ver}"; then
|
||||||
ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')"
|
ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')"
|
||||||
fi
|
fi
|
||||||
echo 'package_name="${name}"; package_ver="${ver}"'
|
echo 'package_name="${name}"; package_ver="${ver}"'
|
||||||
}
|
}
|
||||||
|
|
||||||
function blah {
|
|
||||||
> /dev/null 2>&1
|
|
||||||
}
|
|
Loading…
Reference in a new issue