From ad7d6281475c4adb67e0a43017803aeb4a9059ce Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 3 Apr 2023 03:22:23 +0300 Subject: Some cleanup and further working on the tool --- bin/ak-sm-files | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/ak-sm-files b/bin/ak-sm-files index a22c0d7..6aaea26 100755 --- a/bin/ak-sm-files +++ b/bin/ak-sm-files @@ -2,7 +2,7 @@ # The following creates a mixtape data message # We can extend it by calling the ak-pack_z_block.sh mixtape/add data ZFILESDIR="$AK_WORKDIR/files" -TEMP="/tmp/aktmp" + PROGRAM="$(basename $0)" #set -xe logit(){ @@ -111,9 +111,9 @@ main(){ } EOF -echo "Printing data..." -cat $TEMPASSIN/data -echo "Publishing..." + echo "Printing data..." + cat $TEMPASSIN/data + echo "Publishing..." ak-pack_z_block sha-files/announce data if [ $? == 0 ] @@ -125,16 +125,31 @@ echo "Publishing..." fi } - index(){ tail -n1 $AK_WORKDIR/fmp/* | grep '^[abcdef1234567890]' | awk '{ print $2 }' } +ls-mapfiles(){ + cd $AK_WORKDIR/fmp + for f in `find . -type f | sed -e 's/\.\///g'`;do + FILENAME="$(tail -n1 $f | grep '^[abcdef1234567890]' | awk '{ print $2 }')" + FILEHASH="$(tail -n1 $f | grep '^[abcdef1234567890]' | awk '{ print $1 }')" + MAPFILE="$f" + printf "\nMap: %s\nFilename: %s\nSum: %s\n\n" $MAPFILE $FILENAME $FILEHASH + done +} + +full-index(){ + tail -n1 $AK_WORKDIR/fmp/* | grep '^[abcdef1234567890]' +} + if [ ! -z $1 ]; then case $1 in help) usage; exit;; add) add $2; exit;; index) index; exit;; + full-index) full-index; exit;; + ls-map-files) ls-mapfiles; exit;; *) usage; exit;; esac else usage -- cgit v1.2.3