Compare commits

...

3 Commits

Author SHA1 Message Date
e5ded67a81 Make shasum independend from folder name 2022-07-30 12:29:12 +02:00
241b943997 Fix packagebuild 2022-07-29 19:24:07 +02:00
af5378c912 Add PKGBUILD for Arch 2022-07-29 19:18:59 +02:00
2 changed files with 31 additions and 1 deletions

26
AUR/PKGBUILD Normal file
View File

@@ -0,0 +1,26 @@
pkgname=dirsha256sum
source=("${pkgname}::git+https://git.shimatta.de/mhu/dirsha256sum.git")
sha1sums=('SKIP')
pkgrel=1
arch=('i686' 'x86_64' 'arm')
pkgdesc="Script to calculate a sha256sum over an entire directory"
depends=('coreutils')
provides=('dirsha256sum')
pkgver=1.0.0.r0.g241b943
pkgver () {
cd "$pkgname"
git describe --long --always --tags | sed 's/^v//' | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare () {
:;
}
build () {
:;
}
package () {
cd "$srcdir/$pkgname"
install -D -m775 "$srcdir/$pkgname/$pkgname" "$pkgdir/usr/bin/$pkgname"
}

View File

@@ -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 <path to folder>"
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"