diff --git a/kiss b/kiss index eb3ae96..01d78e6 100755 --- a/kiss +++ b/kiss @@ -141,16 +141,20 @@ sh256() { # All utilities must match 'sha256sum' output. # # Example: ' ' - hash=$( - sha256sum "$1" || - sha256 -r "$1" || - openssl dgst -sha256 -r "$1" || - shasum -a 256 "$1" || - digest -a sha256 "$1" - ) 2>/dev/null || die "Failed to generate checksums for '$1'" + hash= - hash=${hash%% *} - printf '%s\n' "$hash" + if [ ! -d "$1" ] && [ -e "$1" ]; then + hash=$( + sha256sum "$1" || + sha256 -r "$1" || + openssl dgst -sha256 -r "$1" || + shasum -a 256 "$1" || + digest -a sha256 "$1" + ) 2>/dev/null || die "Failed to generate checksums for '$1'" + + hash=${hash%% *} + printf '%s\n' "$hash" + fi } pkg_lint() { @@ -627,7 +631,7 @@ pkg_etcsums() { # This can't be a simple 'find -exec' as 'sh256' is a shell function # and not a real command of any kind. This is the shell equivalent. find "$pkg_dir/$1/etc" ! -type d | sort | while read -r line; do - [ ! -e "$line" ] || sh256 "$line" + sh256 "$line" done > "$pkg_dir/$1/$pkg_db/$1/etcsums" } @@ -1086,7 +1090,7 @@ pkg_remove_files() { while read -r file; do case $file in /etc/?*[!/]) sh256 "$KISS_ROOT/$file" >/dev/null - sum_old=$(grep -F "$hash" "$mak_dir/c") + sum_old=$(grep -F "${hash:=null}" "$mak_dir/c") [ "$hash" = "$sum_old" ] || { printf 'Skipping %s (modified)\n' "$file"