From cc811da3919008d1801233abfd22c6dbf21dc440 Mon Sep 17 00:00:00 2001 From: merakor Date: Sat, 2 May 2020 00:51:04 +0000 Subject: kiss: fallback to sha256 FossilOrigin-Name: 3ea6ab478a038a8e15c2ec4c0ad1bbe2649c96f02a242b8de31cd41c3d9dd464 --- kiss | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kiss b/kiss index e59a202..f4310d8 100755 --- a/kiss +++ b/kiss @@ -499,7 +499,9 @@ pkg_etcsums() ( # prior directory before being able to continue. cd "$pkg_dir/$1/etc" 2>/dev/null || return 0; cd .. - find etc -type f -exec sha256sum {} + > "$pkg_dir/$1/$pkg_db/$1/etcsums" + # Word splitting is intentional here + # shellcheck disable=2086 + find etc -type f -exec $sha256sum {} + > "$pkg_dir/$1/$pkg_db/$1/etcsums" ) pkg_tar() { @@ -698,7 +700,7 @@ pkg_checksums() { # An easy way to get 'sha256sum' to print with the 'basename' # of files is to 'cd' to the file's directory beforehand. - (cd "$src_path" && sha256sum "${src##*/}") || + (cd "$src_path" && $sha256sum "${src##*/}") || die "$1" "Failed to generate checksums" done < "$repo_dir/sources" } @@ -879,8 +881,8 @@ pkg_etc() { # Handle files in /etc/ based on a 3-way checksum check. find etc ! -type d | while read -r file; do - { sum_new=$(sha256sum "$file") - sum_sys=$(cd "$KISS_ROOT/"; sha256sum "$file") + { sum_new=$($sha256sum "$file") + sum_sys=$(cd "$KISS_ROOT/"; $sha256sum "$file") sum_old=$("$grep" "$file$" "$mak_dir/c"); } 2>/dev/null ||: log "$pkg_name" "Doing 3-way handshake for $file" @@ -1476,6 +1478,11 @@ main() { # to cancel, or the user would want to abort building a package. stty intr "^C" + # BSD systems make use of sha256 instead of sha256sum, which has a + # different argument control than sha256sum. This fallbacks to sha256 + # where sha256sum isn't available + sha256sum=$(command -v sha256sum) || sha256sum="sha256 -r" + # This allows for automatic setup of a KISS chroot and will # do nothing on a normal system. mkdir -p "${sys_db:=$KISS_ROOT/$pkg_db}" 2>/dev/null ||: -- cgit v1.2.3