From 7e45b9def509ff28f70c28f50f5aa931f512d81b Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 29 Mar 2023 23:46:45 +0300 Subject: Further renaming --- bin/ak-articles | 4 ++-- bin/ak-categories | 2 +- bin/ak-comments | 10 +++++----- bin/ak-data-expand | 2 +- bin/ak-enter | 2 +- bin/ak-filejoiner | 4 ++-- bin/ak-files | 4 ++-- bin/ak-filesplitter | 6 +++--- bin/ak-find-latest-mined-sblock | 2 +- bin/ak-folders | 34 +++++++++++++++++----------------- bin/ak-follow | 2 +- bin/ak-following | 2 +- bin/ak-ipfs-check | 2 +- bin/ak-ipns-resolve | 2 +- bin/ak-news | 2 +- bin/ak-pack_z_block | 2 +- bin/ak-profile | 4 ++-- bin/ak-reference | 4 ++-- bin/ak-todos | 14 +++++++------- bin/ak-transactions | 2 +- bin/ak-unfollow | 4 ++-- bin/ak-zblock-manipulator | 2 +- bin/ak-zchain-chk | 22 +++++++++++----------- 23 files changed, 67 insertions(+), 67 deletions(-) diff --git a/bin/ak-articles b/bin/ak-articles index 18959ad..ce782b8 100755 --- a/bin/ak-articles +++ b/bin/ak-articles @@ -1,5 +1,5 @@ #!/bin/bash -ZARTICLESDIR="$WORKDIR/articles" +ZARTICLESDIR="$AK_WORKDIR/articles" TEMP="/tmp/aktmp" echo $ZARTICLESDIR if [ ! -d $ZARTICLESDIR ]; then @@ -92,7 +92,7 @@ add(){ TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ipfs add -q $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) cat > data <" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } if [ ! -z "$1" ] && [ ! -z "$2" ] then diff --git a/bin/ak-enter b/bin/ak-enter index 584d0e0..3b2a326 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -19,7 +19,7 @@ PROGRAM="$(basename $0)" logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } usage(){ diff --git a/bin/ak-filejoiner b/bin/ak-filejoiner index 88d965c..2efd9e4 100755 --- a/bin/ak-filejoiner +++ b/bin/ak-filejoiner @@ -28,9 +28,9 @@ then fi fi -MAPSDIR="$WORKDIR/fmp" +MAPSDIR="$AK_WORKDIR/fmp" -CHKDIR="$WORKDIR/ftr" +CHKDIR="$AK_WORKDIR/ftr" cd $CHKDIR if [ "$?" != 0 ] diff --git a/bin/ak-files b/bin/ak-files index 8821a0d..923e246 100755 --- a/bin/ak-files +++ b/bin/ak-files @@ -1,11 +1,11 @@ #!/bin/bash # The following creates a mixtape data message # We can extend it by calling the pack_z_block.sh mixtape/add data -ZFILESDIR="$WORKDIR/files" +ZFILESDIR="$AK_WORKDIR/files" TEMP="/tmp/aktmp" PROGRAM="$(basename $0)" logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } if [ ! -d $ZFILESDIR ]; then mkdir $ZFILESDIR diff --git a/bin/ak-filesplitter b/bin/ak-filesplitter index 0f7919b..56a1b1b 100755 --- a/bin/ak-filesplitter +++ b/bin/ak-filesplitter @@ -29,8 +29,8 @@ else FILE="$1" fi -CHKDIR="$WORKDIR/ftr/" -FILEMAPSDIR="$WORKDIR/fmp/" +CHKDIR="$AK_WORKDIR/ftr/" +FILEMAPSDIR="$AK_WORKDIR/fmp/" TEMPORARYDIR="/tmp/tltmp" TECHDIR="/tmp/tltmp/chks/" CURRENTDIR="$(pwd)/" @@ -38,7 +38,7 @@ CURRENTDIR="$(pwd)/" # echo $CURRENTDIR $BSFILE logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } if [ ! -d "$TECHDIR" ] diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock index b9be842..b98214c 100755 --- a/bin/ak-find-latest-mined-sblock +++ b/bin/ak-find-latest-mined-sblock @@ -4,7 +4,7 @@ cd $MINED_BLOCKS_DIR PROGRAM="$(basename $0)" declare -A counters logitnowint(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } further(){ # logitnowint "[INFO]" "Diving into $1" diff --git a/bin/ak-folders b/bin/ak-folders index a1c8df4..108e7ff 100755 --- a/bin/ak-folders +++ b/bin/ak-folders @@ -1,14 +1,14 @@ #!/bin/bash # The following creates a mixtape data message # We can extend it by calling the pack_z_block.sh mixtape/add data -ZFOLDERSDIR="$WORKDIR/folders" +ZFOLDERSDIR="$AK_WORKDIR/folders" TEMP="/tmp/aktmp" if [ ! -d $ZFOLDERSDIR ]; then mkdir $ZFOLDERSDIR cd $ZFOLDERSDIR git init else - logthis "error $ZFOLDERSDIR not found" + ak-logthis "error $ZFOLDERSDIR not found" fi tempassin(){ if [ ! -z $1 ]; @@ -41,49 +41,49 @@ main(){ FOLDERNAME="$1" CRP="$2" echo "Adding $FOLDERNAME" - logthis "Switching to tmp folder..." + ak-logthis "Switching to tmp folder..." TEMPASSIN="$(tempassin)" cd $TEMPASSIN if [ $? == 0 ]; then - logthis "Success" + ak-logthis "Success" else - logthis "Error with tmp folder" + ak-logthis "Error with tmp folder" exit 5 fi - logthis "Copying $1 to $TEMPASSIN" + ak-logthis "Copying $1 to $TEMPASSIN" cp -r $2/$1 $TEMPASSIN/$1 if [ $? == 0 ]; then - logthis "Copied successfully" + ak-logthis "Copied successfully" else - logthis "Error copying..." + ak-logthis "Error copying..." fi FOLDER="$TEMPASSIN/$1" - logthis "Adding $FOLDER to IPFS..." + ak-logthis "Adding $FOLDER to IPFS..." FOLDER_IPFS_HASH=$(ipfs add -rQ $FOLDER) if [ $? == 0 ]; then - logthis "done" + ak-logthis "done" else - logthis "error" + ak-logthis "error" fi - logthis "Folders are not signing..." + ak-logthis "Folders are not signing..." # NOT NEEDED HERE # SIGN_FOLDER=$FOLDERNAME".asc" # gpg2 --detach-sign --sign-with $FINGERPRINT --armor --output $SIGN_FOLDER $FOLDER # if [ $? == 0 ]; then -# logthis "Signed" +# ak-logthis "Signed" # else -# logthis "Error while signing" +# ak-logthis "Error while signing" # fi # -# logthis "Adding signature to IPFS" +# ak-logthis "Adding signature to IPFS" # SIGNATURE=$(ipfs add -q $TEMPASSIN/$SIGN_FOLDER) # if [ $? == 0 ]; then -# logthis "Added" +# ak-logthis "Added" # else -# logthis "Error while adding" +# ak-logthis "Error while adding" # fi cat > $TEMPASSIN/data <" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } diff --git a/bin/ak-ipns-resolve b/bin/ak-ipns-resolve index 6ea3799..f8bb767 100755 --- a/bin/ak-ipns-resolve +++ b/bin/ak-ipns-resolve @@ -9,7 +9,7 @@ usage(){ echo "Returns the resolved IPFS CIDv0" } logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } if [ ! -z $1 ] then diff --git a/bin/ak-news b/bin/ak-news index 6a73e38..84f5ff8 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -1,5 +1,5 @@ #!/bin/bash -ZNEWSDIR="$WORKDIR/news" +ZNEWSDIR="$AK_WORKDIR/news" TEMP="/tmp/aktmp" echo $ZNEWSDIR if [ ! -d $ZNEWSDIR ]; then diff --git a/bin/ak-pack_z_block b/bin/ak-pack_z_block index 71aa4b7..59ded17 100755 --- a/bin/ak-pack_z_block +++ b/bin/ak-pack_z_block @@ -18,7 +18,7 @@ PROGRAM="$(basename $0)" # Logging patch logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } # Below, the usage information diff --git a/bin/ak-profile b/bin/ak-profile index ed83d29..93dd3ca 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -1,11 +1,11 @@ #!/bin/bash PROGRAM="$(basename $0)" -ZPROFILEDIR="$WORKDIR/profile" +ZPROFILEDIR="$AK_WORKDIR/profile" TEMP="/tmp/aktmp" # Outputs to log file in the classic format :) logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } # Whatever the command is, we check if $ZPROFILEDIR is there. diff --git a/bin/ak-reference b/bin/ak-reference index 59eaa04..79d21fd 100755 --- a/bin/ak-reference +++ b/bin/ak-reference @@ -1,5 +1,5 @@ #!/bin/bash -ZREFERENCESDIR="$WORKDIR/references" +ZREFERENCESDIR="$AK_WORKDIR/references" TEMP="/tmp/aktmp" echo $ZREFERENCESDIR if [ ! -d $ZREFERENCESDIR ]; then @@ -12,7 +12,7 @@ if [ ! -d $ZREFERENCESDIR ]; then git commit -m "Initiated references repository" echo "zreferencesdir created along with git repo" else - logthis "zreferencesdir found" + ak-logthis "zreferencesdir found" fi tempassin(){ if [ ! -z $1 ] diff --git a/bin/ak-todos b/bin/ak-todos index 0c59bba..b95b3a8 100755 --- a/bin/ak-todos +++ b/bin/ak-todos @@ -1,5 +1,5 @@ #!/bin/bash -ZTODOSDIR="$WORKDIR/todos" +ZTODOSDIR="$AK_WORKDIR/todos" TEMP="/tmp/aktmp" if [ ! -d $ZTODOSDIR ]; then mkdir $ZTODOSDIR @@ -9,9 +9,9 @@ if [ ! -d $ZTODOSDIR ]; then echo "Qmetc" >> README git add README git commit -m "Initiated todos repository" - logthis "ztodosdir created along with git repo" + ak-logthis "ztodosdir created along with git repo" else - logthis "ztodosdir found" + ak-logthis "ztodosdir found" fi tempassin(){ if [ ! -z $1 ] @@ -31,14 +31,14 @@ create(){ pwd export TODOS_FILE="$(date -u +%s)" vi $TODOS_FILE - logthis "Renaming..." + ak-logthis "Renaming..." TITLE="$(head -n 1 $TODOS_FILE)" TO_FILE=$TODOS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) IPFS_FILE=$(ipfs add -q $TODOS_FILE) mv $TODOS_FILE $ZTODOSDIR/$TO_FILE sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZTODOSDIR/README add $ZTODOSDIR/$TO_FILE - logthis "Adding to git repo..." + ak-logthis "Adding to git repo..." cd $ZTODOSDIR git add $TO_FILE README git commit -m "Added $TO_FILE with $(head -n 1 $ZTODOSDIR/$TO_FILE)" @@ -86,7 +86,7 @@ add(){ tempassin if [ -f $1 ]; then FILE="$1" - logthis "Adding todos from $FILE" + ak-logthis "Adding todos from $FILE" DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ipfs add -q $FILE) @@ -109,7 +109,7 @@ EOF pack_z_block "todos/add" data if [ $? == 0 ] then - logthis "Todos added successfully" + ak-logthis "Todos added successfully" else echo "error??" exit 1 diff --git a/bin/ak-transactions b/bin/ak-transactions index 546082c..30fd5eb 100755 --- a/bin/ak-transactions +++ b/bin/ak-transactions @@ -5,7 +5,7 @@ usage(){ } logit(){ - logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "<$PROGRAM>" "$1" "$2" } main(){ diff --git a/bin/ak-unfollow b/bin/ak-unfollow index 6b9e1d6..c574b79 100755 --- a/bin/ak-unfollow +++ b/bin/ak-unfollow @@ -12,10 +12,10 @@ then then profile set repositories "$IPFS" else - logthis "IPFS problem" + ak-logthis "IPFS problem" fi else - logthis "sed didn't found $search" + ak-logthis "sed didn't found $search" fi else echo "Who to unfollow?" diff --git a/bin/ak-zblock-manipulator b/bin/ak-zblock-manipulator index 29b1779..433ab11 100755 --- a/bin/ak-zblock-manipulator +++ b/bin/ak-zblock-manipulator @@ -43,7 +43,7 @@ usage(){ main(){ - logthis "We are doing" $BLOCK_TO_ADD "with content" $PREVIOUS + ak-logthis "We are doing" $BLOCK_TO_ADD "with content" $PREVIOUS # We add it to IPFS MESSAGE_HASH=$(ipfs add -q $MESSAGE) diff --git a/bin/ak-zchain-chk b/bin/ak-zchain-chk index c75dc4b..963754c 100755 --- a/bin/ak-zchain-chk +++ b/bin/ak-zchain-chk @@ -67,36 +67,36 @@ do # Reset timestamp since it's introduced later timestamp='' # Announce to stdout which ZBLOCK is being read at the moment - logthis "[INFO]" "Examining $zblock" + ak-logthis "[INFO]" "Examining $zblock" # We create files named after each ZBLOCK IPFS CID for later # reference. Files are empty. touch $ZBLOCKDIR/$zblock - logthis "[INFO]" "Created reference" + ak-logthis "[INFO]" "Created reference" # We concatenate the zblock's contents, pipe them through filter # json2bash and output them to tmp-file ipfs cat $zblock | json2bash > $TEMPASSIN/tmp-zblock - logthis "[INFO]" "ZBLOCK $zblock READ" + ak-logthis "[INFO]" "ZBLOCK $zblock READ" # Supposingly you are on a safe environment and you only have # access to your chain, I would consider mild secure to source # the files into your bash. # File an issue/pull request if you think it can be done better!! source $TEMPASSIN/tmp-zblock - logthis "[INFO]" "ZBLOCK SOURCED" + ak-logthis "[INFO]" "ZBLOCK SOURCED" # Same as above applies to BLOCK and DATA subparts of each ZBLOCK # BLOCKS ipfs cat $block | json2bash > $TEMPASSIN/tmp-block source $TEMPASSIN/tmp-block - logthis "[INFO]" "BLOCK $block SOURCED" + ak-logthis "[INFO]" "BLOCK $block SOURCED" touch $BLOCKDIR/$block - logthis "[INFO]" "BLOCK REFERENCED" + ak-logthis "[INFO]" "BLOCK REFERENCED" module="$(echo $action | sed -e 's/\// /g' | awk '{ print $1 }')" - logthis "[INFO]" "DATA is $module module." + ak-logthis "[INFO]" "DATA is $module module." command="$(echo $action | sed -e 's/\// /g' | awk '{ print $2 }')" - logthis "[INFO]" "COMMAND is $command" + ak-logthis "[INFO]" "COMMAND is $command" if [ ! -v $timestamp ] then echo "$timestamp : $zblock -> $block -> $previous" @@ -109,7 +109,7 @@ do # code 0 if [ -v $previous ] then - logthis "[ERROR]" "Block $block has no previous zblock" + ak-logthis "[ERROR]" "Block $block has no previous zblock" echo "Chain with no genesis" if [ "$fix" == "1" ] then @@ -132,12 +132,12 @@ do elif [ "$zblock" == "$seed" ] then echo "Chain is OK with GENESIS block = $seed" - logthis "[INFO]" "Counter $counter" + ak-logthis "[INFO]" "Counter $counter" exit 0 fi # And finally, if nothing is there exit with error else - logthis "[ERROR]" "Check not passed... No previous IPFS CID" + ak-logthis "[ERROR]" "Check not passed... No previous IPFS CID" exit 1 fi done -- cgit v1.2.3