From 0980dc877d58100f7c9f8a268bb737a88d8df6d7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 16 Jul 2021 13:50:53 +0300 Subject: [PATCH] kiss: remove subshell from kiss c --- kiss | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kiss b/kiss index 3e4ad26..52b94c7 100755 --- a/kiss +++ b/kiss @@ -935,6 +935,11 @@ pkg_checksums() { case $_res in */*[!.]) sh256 "$_res" + + # Store the generated checksums in a string for use internally + # without the need for subshells. + _hash="$_hash${_hash:+" +"}$hash" esac done < "$repo_dir/sources" || die "$1" "Failed to generate checksums" } @@ -1797,15 +1802,14 @@ args() { continue } - sums=$(pkg_checksums "$pkg") + pkg_checksums "$pkg" - [ "$sums" ] || { + [ "$_hash" ] || { log "$pkg" "No sources needing checksums" continue } - printf '%s\n' "$sums" - printf '%s\n' "$sums" > "$repo_dir/checksums" + printf '%s\n' "$_hash" > "$repo_dir/checksums" log "$pkg" "Generated checksums" done ;;