Cover no packages edge case when writing manifest.

This commit is contained in:
awalsh128 2022-09-12 18:39:48 -07:00
parent 270a15701d
commit e32a1a4ea0

4
lib.sh
View file

@ -47,8 +47,12 @@ function log_empty_line { echo ""; }
# Writes the manifest to a specified file.
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
}