diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 03:40:06 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 03:40:06 +0300 |
commit | 0c8f9f5ed254c923c368c8fa92d352f8da89b3ca (patch) | |
tree | 3cf2738bc8d9a7844ac18356a16f3b91c4187073 /bin/ak-fs-get | |
parent | 00bcb191d56b8dbc40c12058236eb12827b1b320 (diff) | |
download | arching-kaos-tools-0c8f9f5ed254c923c368c8fa92d352f8da89b3ca.tar.gz arching-kaos-tools-0c8f9f5ed254c923c368c8fa92d352f8da89b3ca.tar.bz2 arching-kaos-tools-0c8f9f5ed254c923c368c8fa92d352f8da89b3ca.zip |
- Moved previous ak-fs-* scripts to library
- Made an ak-fs to select the previous as flags in a "main script"
- Feature: 3rd_gen_map where the sha512sum of the original file (pre
base64 encoding) and its original named are stored in the first line
and the second line holds the sha512sum of the level.1.map
new file: bin/ak-fs
deleted: bin/ak-fs-add
deleted: bin/ak-fs-cat
deleted: bin/ak-fs-get
modified: lib/_ak_fs
Diffstat (limited to 'bin/ak-fs-get')
-rwxr-xr-x | bin/ak-fs-get | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/bin/ak-fs-get b/bin/ak-fs-get deleted file mode 100755 index ea56caa..0000000 --- a/bin/ak-fs-get +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash -PROGRAM="$(basename $0)" -# set -xe -if [ -z $1 ] -then - echo "Please provide a SHA512 hash" - exit 1 -fi -if [ -z $2 ] -then - echo "Please an output filename" - exit 2 -fi - -echo $1 | grep "[0123456789abcdef]\{128\}" -if [ $? -ne 0 ] -then - echo "Look, I asked for a SHA512 hash, please try again" - exit 1 -fi -treeRootHash="$1" -outputFilename="$2" - -fmrk="$AK_WORKDIR/fmrk" -ftr="$AK_WORKDIR/ftr" - -# This would be a kind of bootstrap for remote downloads -# -#remoteMrk="http://z.kaotisk-hund.com:8610/mrk" -#remoteTr="http://z.kaotisk-hund.com:8610/tr" -# -pwd>.pwd - -dirWeWere=$(cat .pwd) - -# Enter temp folder -TEMPASSIN="$(ak-tempassin)" -cd $TEMPASSIN - -findDepth(){ - currentNode="$1" - pathToNode="$fmrk/$(ak-sm-hash-to-path --path $currentNode)" - if [ -f $pathToNode ] && [ "$(du -b $pathToNode | awk '{print $1}')" == "258" ] - then - fileHead="$(head -n 1 $pathToNode)" - counter="$(expr $counter + 1)" - findDepth "$fileHead" - elif [ ! -f $pathToNode ] - then - printf "%s" "$counter" > depth - else - exit 111 -# Try to download stuff -# wget -s $remoteMrk/$currentNode -O $fmrk/$currentNode -# if [ "$?" -ne 0 ] -# then -# exit 111 -# fi -# findDepth "$currentNode" - fi -} - -currentNode="$treeRootHash" -counter=0 - -printf "%s" "$currentNode" > workspace.0 -findDepth "$currentNode" -depth="$(expr `cat depth` + 1)" -counter="0" -printf "%s" "$depth" -if [ -f output ] -then - rm output -fi -touch output - -while [ "$counter" != "$depth" ] -do - printf "Entering loop... %s %s\n" "$counter" "$depth" - while IFS="" read -r p || [ -n "$p" ] - do - nextLevel="$(expr $counter + 1)" - if [ "$p" == "" ] - then - echo hi - else - expectedPath="$fmrk/$(ak-sm-hash-to-path --path $p)" - if [ -f $expectedPath ] - then - if [ "$(head -n 1 $expectedPath)" == "$(tail -n 1 $expectedPath)" ] - then - head -n 1 $expectedPath >> workspace.$nextLevel - else - cat $expectedPath >> workspace.$nextLevel - fi - elif [ -f $ftr/$p ] - then - cat $ftr/$p >> output - fi - fi - done < workspace.$counter - counter="$(expr $counter + 1)" -done - -base64 -d output > $dirWeWere/$outputFilename -rm $dirWeWere/.pwd -printf "Recreation of $treeRootHash as $outputFilename succeeded!" |