mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2025-09-20 18:17:15 +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 ""; }
|
function log_empty_line { echo ""; }
|
||||||
|
|
||||||
# Writes the manifest to a specified file.
|
# Writes the manifest to a specified file.
|
||||||
function write_manifest {
|
function write_manifest {
|
||||||
log "Writing ${1} packages manifest to ${3}..."
|
if [ ${#2} -eq 0 ]; then
|
||||||
# 0:-1 to remove trailing comma, delimit by newline and sort.
|
log "Skipped ${1} manifest write. No packages to install."
|
||||||
echo "${2:0:-1}" | tr ',' '\n' | sort > ${3}
|
else
|
||||||
log "done"
|
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