aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-02 00:51:04 +0000
committermerakor <cem@ckyln.com>2020-05-02 00:51:04 +0000
commitcc811da3919008d1801233abfd22c6dbf21dc440 (patch)
tree4b19373006ee6a58b972793e3ce9954888829b46 /kiss
parent82b1594543b7cb140542508e0f0a3e138c8b15a6 (diff)
downloadcpt-cc811da3919008d1801233abfd22c6dbf21dc440.tar.gz
kiss: fallback to sha256
FossilOrigin-Name: 3ea6ab478a038a8e15c2ec4c0ad1bbe2649c96f02a242b8de31cd41c3d9dd464
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss15
1 files 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 ||: