diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-05-09 04:20:03 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-05-09 04:20:03 +0300 |
commit | d33d9ae7d589aace88324d14504b3ae73e22ad83 (patch) | |
tree | 5bbda0b53997fe938dfc213e9853844eb8cdd1ef /bin/ak-fs-add | |
parent | b18332a916c233fdcd089bf8a7c7f172fd57a47a (diff) | |
download | arching-kaos-tools-d33d9ae7d589aace88324d14504b3ae73e22ad83.tar.gz arching-kaos-tools-d33d9ae7d589aace88324d14504b3ae73e22ad83.tar.bz2 arching-kaos-tools-d33d9ae7d589aace88324d14504b3ae73e22ad83.zip |
applying the hash tree driver to ak-fs-add and ak-fs-get
Diffstat (limited to 'bin/ak-fs-add')
-rwxr-xr-x | bin/ak-fs-add | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/ak-fs-add b/bin/ak-fs-add index 34ee3c0..0011faf 100755 --- a/bin/ak-fs-add +++ b/bin/ak-fs-add @@ -183,14 +183,17 @@ do sed -n "$a"p "$workingIndex" | awk '{ print $1 }' >> level.$c.pair.$a-$b sed -n "$b"p "$workingIndex" | awk '{ print $1 }' >> level.$c.pair.$a-$b shaSum="$(sha512sum level.$c.pair.$a-$b | awk '{ print $1 }')" - cp level.$c.pair.$a-$b $MERKLEDIR/$shaSum + mkdir -p $MERKLEDIR/$(_ak_return_hash_dir $shaSum) + cp level.$c.pair.$a-$b $MERKLEDIR/$(_ak_return_hash_path $shaSum) sha512sum level.$c.pair.$a-$b | awk '{ print $1 }' >> level.$c.map a=`expr "$a" + 2` done workingIndex="level.$c.map" appendLastIfNotEven "$workingIndex" shaSum=`sha512sum $workingIndex | awk '{ print $1 }'` - cp $workingIndex $MERKLEDIR/$shaSum + mkdir -p $MERKLEDIR/$(_ak_return_hash_dir $shaSum) + cp $workingIndex $MERKLEDIR/$(_ak_return_hash_path $shaSum) +# cp $workingIndex $MERKLEDIR/$shaSum totalChunks=`cat $workingIndex | wc -l` c=`expr $c - 1` done @@ -211,7 +214,7 @@ rm $TEMPORARYDIR/map2 counter=0 while IFS="" read -r p || [ -n "$p" ] do - printf "mv %s %s%s\n" "$(echo $p | awk '{ print $2 }')" "$CHKDIR" "$(echo $p | awk '{ print $1 }')" >> $TEMPORARYDIR/cmd_queue.sh + printf "mv %s %s/%s\n" "$(echo $p | awk '{ print $2 }')" "$CHKDIR" "$(echo $p | awk '{ print $1 }')" >> $TEMPORARYDIR/cmd_queue.sh counter=`expr "$counter" + 1` done < $TEMPORARYDIR/map @@ -228,7 +231,7 @@ echo "$CHECKSUM $(basename "$FILE")" >> $TEMPORARYDIR/map MAPFILEHASH="$(sha512sum $TEMPORARYDIR/map | awk '{ print $1 }')" # and we rename it with it and move it to FILEMAPSDIR -`sha512sum $TEMPORARYDIR/map | awk '{print "mv " $2 " '$FILEMAPSDIR'" $1}'` +`sha512sum $TEMPORARYDIR/map | awk '{print "mv " $2 " '$FILEMAPSDIR/'" $1}'` # We remove the TEMPORARYDIR rm -rf $TEMPORARYDIR |