Make shasum independend from folder name
This commit is contained in:
		@@ -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'
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user