kiss: Fix bug with empty post-install messages.

This never truly worked as the post-install message would always
ensure that file size is '> 0' despite there being nothing to show
the user.

We now store the output to a variable, ensure it isn't empty and
go on our merry way.
This commit is contained in:
Dylan Araps 2020-07-18 19:42:14 +03:00
parent 47190ffc08
commit 8848d3f1d3
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

11
kiss
View File

@ -1152,10 +1152,13 @@ pkg_install() {
trap pkg_clean EXIT INT
if [ -x "$sys_db/$pkg_name/post-install" ]; then
log "$pkg_name" "Running post-install hook"; {
log "$pkg_name" "post-install log"
"$sys_db/$pkg_name/post-install"
} 2>&1 | tee -a "$log_dir/post-install-$time-$pid" >/dev/null
log "$pkg_name" "Running post-install hook"
hook_output=$("$sys_db/$pkg_name/post-install" 2>&1)
[ -z "$hook_output" ] ||
printf '=> %s post-install log\n%s\n' "$pkg_name" "$hook_output" |
tee -a "$log_dir/post-install-$time-$pid" >/dev/null
fi
run_hook post-install "$pkg_name" "$sys_db/$pkg_name"