From e5ded67a814a44048cad2467fee404037162e696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sat, 30 Jul 2022 12:29:12 +0200 Subject: [PATCH] Make shasum independend from folder name --- AUR/PKGBUILD | 2 +- dirsha256sum | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AUR/PKGBUILD b/AUR/PKGBUILD index 71221bd..18f9d54 100644 --- a/AUR/PKGBUILD +++ b/AUR/PKGBUILD @@ -6,7 +6,7 @@ arch=('i686' 'x86_64' 'arm') pkgdesc="Script to calculate a sha256sum over an entire directory" depends=('coreutils') provides=('dirsha256sum') -pkgver=bb2839e +pkgver=1.0.0.r0.g241b943 pkgver () { cd "$pkgname" git describe --long --always --tags | sed 's/^v//' | sed 's/\([^-]*-g\)/r\1/;s/-/./g' diff --git a/dirsha256sum b/dirsha256sum index 561ffe5..467b70b 100755 --- a/dirsha256sum +++ b/dirsha256sum @@ -2,6 +2,9 @@ # This script calculates a sha256sum over all files in a dirextory including its subdirectories +# Length of the sha256 hash. Adapt when changing hash algorithm +hashlen=64 + if [[ -z $1 ]]; then echo "Usage: $0 " exit -1 @@ -23,7 +26,8 @@ echo "Found ${#filelist[@]} files" # Calculate shasums over all files shasum=`for file in "${filelist[@]}"; do - sha256sum "$file" + sha256sum "$file" | head -c $hashlen + echo "" done | sha256sum | sed 's/\s-//'` echo "$shasum"