mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2025-09-20 01:57:16 +00:00
Cover no packages edge case when writing manifest.
This commit is contained in:
parent
270a15701d
commit
e32a1a4ea0
14
lib.sh
14
lib.sh
|
@ -46,9 +46,13 @@ function log_err { >&2 echo "$(date +%H:%M:%S)" "${@}"; }
|
|||
function log_empty_line { echo ""; }
|
||||
|
||||
# Writes the manifest to a specified file.
|
||||
function write_manifest {
|
||||
log "Writing ${1} packages manifest to ${3}..."
|
||||
# 0:-1 to remove trailing comma, delimit by newline and sort.
|
||||
echo "${2:0:-1}" | tr ',' '\n' | sort > ${3}
|
||||
log "done"
|
||||
function write_manifest {
|
||||
if [ ${#2} -eq 0 ]; then
|
||||
log "Skipped ${1} manifest write. No packages to install."
|
||||
else
|
||||
log "Writing ${1} packages manifest to ${3}..."
|
||||
# 0:-1 to remove trailing comma, delimit by newline and sort.
|
||||
echo "${2:0:-1}" | tr ',' '\n' | sort > ${3}
|
||||
log "done"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue