From 8848d3f1d3a2804b38b3238a8a7e97a8045efc3c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 18 Jul 2020 19:42:14 +0300 Subject: [PATCH] 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. --- kiss | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kiss b/kiss index 21e9335..f1be697 100755 --- a/kiss +++ b/kiss @@ -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"