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-get | |
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-get')
-rwxr-xr-x | bin/ak-fs-get | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/ak-fs-get b/bin/ak-fs-get index 556f499..ea56caa 100755 --- a/bin/ak-fs-get +++ b/bin/ak-fs-get @@ -39,12 +39,13 @@ cd $TEMPASSIN findDepth(){ currentNode="$1" - if [ -f $fmrk/$currentNode ] && [ "$(du -b $fmrk/$currentNode | awk '{print $1}')" == "258" ] + pathToNode="$fmrk/$(ak-sm-hash-to-path --path $currentNode)" + if [ -f $pathToNode ] && [ "$(du -b $pathToNode | awk '{print $1}')" == "258" ] then - fileHead="$(head -n 1 $fmrk/$currentNode)" + fileHead="$(head -n 1 $pathToNode)" counter="$(expr $counter + 1)" findDepth "$fileHead" - elif [ ! -f $fmrk/$currentNode ] + elif [ ! -f $pathToNode ] then printf "%s" "$counter" > depth else @@ -83,13 +84,14 @@ do then echo hi else - if [ -f $fmrk/$p ] + expectedPath="$fmrk/$(ak-sm-hash-to-path --path $p)" + if [ -f $expectedPath ] then - if [ "$(head -n 1 $fmrk/$p)" == "$(tail -n 1 $fmrk/$p)" ] + if [ "$(head -n 1 $expectedPath)" == "$(tail -n 1 $expectedPath)" ] then - head -n 1 $fmrk/$p >> workspace.$nextLevel + head -n 1 $expectedPath >> workspace.$nextLevel else - cat $fmrk/$p >> workspace.$nextLevel + cat $expectedPath >> workspace.$nextLevel fi elif [ -f $ftr/$p ] then |