diff options
Diffstat (limited to 'bin')
54 files changed, 385 insertions, 172 deletions
diff --git a/bin/ak-articles b/bin/ak-articles index ce782b8..1eb3056 100755 --- a/bin/ak-articles +++ b/bin/ak-articles @@ -35,7 +35,7 @@ create(){ echo "Renaming..." TITLE="$(head -n 1 $ARTICLES_FILE)" TO_FILE=$ARTICLES_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) - IPFS_FILE=$(ipfs add -q $ARTICLES_FILE) + IPFS_FILE=$(ak-ipfs-add $ARTICLES_FILE) mv $ARTICLES_FILE $ZARTICLESDIR/$TO_FILE sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZARTICLESDIR/README add $ZARTICLESDIR/$TO_FILE @@ -90,10 +90,10 @@ add(){ echo "Adding articles from " $FILE DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) - FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE - FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) + FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { "datetime":"$DATETIME", @@ -107,7 +107,7 @@ EOF echo "File $FILE doesn't exist"; exit 2 fi - pack_z_block "articles/add" data + ak-pack_z_block "articles/add" data if [ $? == 0 ] then echo "Articles added successfully" diff --git a/bin/ak-calculate-size b/bin/ak-calculate-size index 640d841..45fa5fa 100755 --- a/bin/ak-calculate-size +++ b/bin/ak-calculate-size @@ -2,7 +2,7 @@ extract-cids > to_stats sum=0 ; while IFS="" read -r p || [ -n "$p" ] do - num=$(ipfs block stat $p | grep Size | sed -e 's/Size: //g') + num=$(ak-ipfs-block-stat $p | grep Size | sed -e 's/Size: //g') sum=$(expr $sum + $num ) done < to_stats echo "Chain is : $sum bytes" diff --git a/bin/ak-categories b/bin/ak-categories index c9edd3c..5bc67d7 100755 --- a/bin/ak-categories +++ b/bin/ak-categories @@ -35,7 +35,7 @@ create(){ echo "Renaming..." TITLE="$(head -n 1 $NEWS_FILE)" TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) - IPFS_FILE=$(ipfs add -q $NEWS_FILE) + IPFS_FILE=$(ak-ipfs-add $NEWS_FILE) mv $NEWS_FILE $ZNEWSDIR/$TO_FILE sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZNEWSDIR/README add $ZNEWSDIR/$TO_FILE @@ -90,10 +90,10 @@ add(){ echo "Adding news from " $FILE DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) - FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE - FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) + FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { "datetime":"$DATETIME", @@ -107,7 +107,7 @@ EOF echo "File $FILE doesn't exist"; exit 2 fi - pack_z_block "news/add" data + ak-pack_z_block "news/add" data if [ $? == 0 ] then echo "News added successfully" diff --git a/bin/ak-comments b/bin/ak-comments index 5dd4f08..2934e00 100755 --- a/bin/ak-comments +++ b/bin/ak-comments @@ -36,7 +36,7 @@ create(){ vi $COMMENTS_FILE echo "Renaming..." TO_FILE=$COMMENTS_FILE - IPFS_FILE=$(ipfs add -q $COMMENTS_FILE) + IPFS_FILE=$(ak-ipfs-add $COMMENTS_FILE) mv $COMMENTS_FILE $ZCOMMENTSDIR/$TO_FILE add $TO_FILE ak-logthis "[INFO]" "Adding to git repo..." @@ -70,10 +70,10 @@ add(){ FILE=$ZCOMMENTSDIR/$1 echo "Adding comments from " $FILE DATETIME="$1" - FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE - FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) + FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { "datetime":"$DATETIME", @@ -85,7 +85,7 @@ EOF echo "File $FILE doesn't exist"; exit 2 fi - REFERENCE="$(pack_z_block "comments/add" data)" + REFERENCE="$(ak-pack_z_block "comments/add" data)" if [ $? == 0 ] then echo "Comment added successfully" diff --git a/bin/ak-config b/bin/ak-config index b64c731..3c7f641 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -28,7 +28,7 @@ show(){ publish(){ show | jq -M > tmpfile - ipfs name publish --key=ak-config /ipfs/$(ipfs add -q tmpfile) + ak-ipfs-name-publish --key=ak-config /ipfs/$(ak-ipfs-add tmpfile) if [ "$?" != 0 ] then echo -e "\033[0;34mError on publishing\033[0;0m\nYour information:\n" @@ -39,13 +39,13 @@ publish(){ } published(){ - ipfs cat $(get_akid) + ak-ipfs-cat $(get_akid) } # We will be using our public key also to put it in the block later KEY="tmp-gpg.pub" gpg2 --armour --output $KEY --export $FINGERPRINT -GPG_PUB_KEY=$(ipfs add -q $KEY) +GPG_PUB_KEY=$(ak-ipfs-add $KEY) rm $KEY if [ ! -z $1 ]; then diff --git a/bin/ak-data-expand b/bin/ak-data-expand index 35f7826..08aae20 100755 --- a/bin/ak-data-expand +++ b/bin/ak-data-expand @@ -11,37 +11,37 @@ then logit "[ERROR]" "Invalid hash format for $1" exit 1 fi - ipfs --timeout=10s cat $1 > /dev/null + ak-ipfs-cat $1 > /dev/null if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while reading $1" exit 1 fi - ipfs --timeout=10s cat $1 | jq -M > /dev/null + ak-ipfs-cat $1 | jq -M > /dev/null if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while parsing JSON for $1" exit 1 fi - ipfs --timeout=10s cat $1 | jq | grep ipfs > /dev/null + ak-ipfs-cat $1 | jq | grep ipfs > /dev/null if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while extracting data from JSON for $1" exit 1 fi - DATA="$(ipfs --timeout=10s cat $1 | jq | grep ipfs | sed -e 's/"ipfs": "//g; s/[",]//g; s/ //g')" + DATA="$(ak-ipfs-cat $1 | jq | grep ipfs | sed -e 's/"ipfs": "//g; s/[",]//g; s/ //g')" if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while extracting data from JSON for $1" exit 1 fi - ipfs --timeout=10s cat $1 | jq | grep detach > /dev/null + ak-ipfs-cat $1 | jq | grep detach > /dev/null if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while extracting data from JSON for $1" exit 1 fi - DETACH="$(ipfs --timeout=10s cat $1 | jq | grep detach | sed -e 's/"detach": "//g; s/[",]//g; s/ //g')" + DETACH="$(ak-ipfs-cat $1 | jq | grep detach | sed -e 's/"detach": "//g; s/[",]//g; s/ //g')" if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while extracting data from JSON for $1" @@ -54,7 +54,7 @@ then exit 1 fi gpg="$2" - ipfs --timeout=10s get $gpg > /dev/null 2>&1 + ak-ipfs-get $gpg > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not get GPG key: $gpg" @@ -66,7 +66,7 @@ then logit "[ERROR]" "Could not import GPG key: $gpg" exit 1 fi - ipfs --timeout=10s get $DETACH > /dev/null 2>&1 + ak-ipfs-get $DETACH > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while getting signature: $DETACH for data: $DATA" @@ -74,7 +74,7 @@ then fi mv $DETACH $DATA.asc logit "[INFO]" "Block signature downloaded" - ipfs --timeout=10s get $DATA > /dev/null 2>&1 + ak-ipfs-get $DATA > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while getting data: $DATA" @@ -88,7 +88,7 @@ then exit 1 fi logit "[INFO]" "Block signature verified" - echo -n '"data":{"'$1'":'$(ipfs --timeout=10s cat $1)'},' + echo -n '"data":{"'$1'":'$(ak-ipfs-cat $1)'},' exit 0 else echo "Usage: $PROGRAM HASH GPG" diff --git a/bin/ak-enter b/bin/ak-enter index 0f3b17c..dd65dcf 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -1,5 +1,5 @@ #!/bin/bash -# enter +# ak-enter # # Using this tool, we can seek a whole zchain, if available from # an IPFS CID or an IPNS link. @@ -8,10 +8,10 @@ # from the IPFS CID stored in the file that is tracked by the # $AK_ZLATEST environment variable. # -# enter [-n IPNS_LINK] -# enter [IPFS CID] -# enter -nV -# enter +# ak-enter [-n IPNS_LINK] +# ak-enter [IPFS CID] +# ak-enter -nV +# ak-enter # # Returns a JSON array representing the chain retrieved. # Logs messages to $LOGSFILE. @@ -61,7 +61,7 @@ then fi entrance="$1" else - # By default we enter from the latest block + # By default we ak-enter from the latest block # We can alter this by changing this value entrance="$(cat $AK_ZLATEST)" fi @@ -105,7 +105,7 @@ do # them to tmp-file # # We check if any $zblock at all - ipfs --timeout=10s cat $zblock > /dev/null 2>&1 + ak-ipfs-cat $zblock > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "ZBLOCK $zblock READ failed" @@ -114,7 +114,7 @@ do logit "[INFO]" "ZBLOCK $zblock READ" # If it's JSON formated - ipfs --timeout=10s cat $zblock | jq -M > /dev/null 2>&1 + ak-ipfs-cat $zblock | jq -M > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "ZBLOCK $zblock is not JSON" @@ -123,7 +123,7 @@ do logit "[INFO]" "ZBLOCK $zblock is JSON" # Then we pass it through the filter and save it - ipfs --timeout=10s cat $zblock | ak-json2bash > $TEMPASSIN/tmp-zblock + ak-ipfs-cat $zblock | ak-json2bash > $TEMPASSIN/tmp-zblock # Be sure that there are the expected values # We need 'block' and 'block_signature' inside a 'zblock' @@ -159,7 +159,7 @@ do # Same as above applies to BLOCK and DATA subparts of each ZBLOCK # BLOCKS echo -n '"block":"'$block'",' - ipfs --timeout=10s cat $block | ak-json2bash > $TEMPASSIN/tmp-block + ak-ipfs-cat $block | ak-json2bash > $TEMPASSIN/tmp-block if [ "$?" -ne 0 ] then logit "[ERROR]" "BLOCK $block READ failed" @@ -193,7 +193,7 @@ do echo -n '"gpg":"'$gpg'",' if [ $verify == 1 ] then - ipfs get $gpg > /dev/null 2>&1 + ak-ipfs-get $gpg > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not get GPG key: $gpg ." @@ -205,7 +205,7 @@ do logit "[ERROR]" "Could not import GPG key: $gpg ." exit 1 fi - ipfs get $block_signature > /dev/null 2>&1 + ak-ipfs-get $block_signature > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while getting $block_signature for $block" @@ -213,7 +213,7 @@ do fi mv $block_signature $block.asc logit "[INFO]" "Block signature downloaded" - ipfs get $block > /dev/null 2>&1 + ak-ipfs-get $block > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not get $block block" @@ -238,7 +238,7 @@ do # DATA (but we don't source it's stuff) # Only print to stdout - #ipfs --timeout=10s cat $data + #ak-ipfs-cat $data touch $DATADIR/$data # Now, since we sourced the BLOCK to our terminal, we can search diff --git a/bin/ak-extract-cids b/bin/ak-extract-cids index 06b7ebc..3076ace 100755 --- a/bin/ak-extract-cids +++ b/bin/ak-extract-cids @@ -1,8 +1,8 @@ #!/bin/bash # -# Extracts unique IPFS CIDs from an entered zchain +# Extracts unique IPFS CIDs from an ak-entered zchain # # Previously: -# enter | jq | grep Qm | sed -e 's/^.*Qm/Qm/g' | cut -d '"' -f 1 +# ak-enter | jq | grep Qm | sed -e 's/^.*Qm/Qm/g' | cut -d '"' -f 1 # -enter | jq | grep Qm | sed -e 's/".*"://g; s/ //g; s/[{,"]//g' | sort | uniq +ak-enter | jq | grep Qm | sed -e 's/".*"://g; s/ //g; s/[{,"]//g' | sort | uniq diff --git a/bin/ak-files b/bin/ak-files index 9fddc60..448ae76 100755 --- a/bin/ak-files +++ b/bin/ak-files @@ -1,6 +1,6 @@ #!/bin/bash # The following creates a mixtape data message -# We can extend it by calling the pack_z_block.sh mixtape/add data +# 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)" @@ -71,7 +71,7 @@ main(){ FILE="$TEMPASSIN/$1" logit "[INFO]" "Adding $FILE to IPFS..." - FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_IPFS_HASH=$(ak-ipfs-add $FILE) if [ $? == 0 ]; then logit "[INFO]" "Added $FILE to IPFS" else @@ -87,7 +87,7 @@ main(){ fi logit "[INFO]" "Adding signature to IPFS" - SIGNATURE=$(ipfs add -q $TEMPASSIN/$SIGN_FILE) + SIGNATURE=$(ak-ipfs-add $TEMPASSIN/$SIGN_FILE) if [ $? == 0 ]; then logit "[INFO]" "Added" else @@ -107,7 +107,7 @@ echo "Printing data..." cat $TEMPASSIN/data echo "Publishing..." - pack_z_block files/add data + ak-pack_z_block files/add data if [ $? == 0 ] then echo "cool" diff --git a/bin/ak-folders b/bin/ak-folders index 234592a..df88ca1 100755 --- a/bin/ak-folders +++ b/bin/ak-folders @@ -1,6 +1,6 @@ #!/bin/bash # The following creates a mixtape data message -# We can extend it by calling the pack_z_block.sh mixtape/add data +# We can extend it by calling the ak-pack_z_block.sh mixtape/add data ZFOLDERSDIR="$AK_WORKDIR/folders" TEMP="/tmp/aktmp" if [ ! -d $ZFOLDERSDIR ]; then @@ -61,7 +61,7 @@ main(){ FOLDER="$TEMPASSIN/$1" ak-logthis "Adding $FOLDER to IPFS..." - FOLDER_IPFS_HASH=$(ipfs add -rQ $FOLDER) + FOLDER_IPFS_HASH=$(ak-ipfs-add $FOLDER) if [ $? == 0 ]; then ak-logthis "done" else @@ -79,7 +79,7 @@ main(){ # fi # # ak-logthis "Adding signature to IPFS" -# SIGNATURE=$(ipfs add -q $TEMPASSIN/$SIGN_FOLDER) +# SIGNATURE=$(ak-ipfs-add $TEMPASSIN/$SIGN_FOLDER) # if [ $? == 0 ]; then # ak-logthis "Added" # else @@ -98,7 +98,7 @@ echo "Printing data..." cat $TEMPASSIN/data echo "Publishing..." - pack_z_block folders/add data + ak-pack_z_block folders/add data if [ $? == 0 ] then echo "cool" diff --git a/bin/ak-follow b/bin/ak-follow index a72ba8b..9177c7f 100755 --- a/bin/ak-follow +++ b/bin/ak-follow @@ -3,7 +3,7 @@ FOLLOWING="$HOME/.arching-kaos/following" if [ ! -z $1 ] then echo $1 >> $FOLLOWING - IPFS=$(ipfs add -q $FOLLOWING) + IPFS=$(ak-ipfs-add $FOLLOWING) if [ $? == 0 ] then profile set following $IPFS diff --git a/bin/ak-get-akid b/bin/ak-get-akid index 17dcf74..61bc563 100755 --- a/bin/ak-get-akid +++ b/bin/ak-get-akid @@ -1,5 +1,5 @@ #!/bin/bash # Resolves the IPNS key "ak-config" to its current IPFS value # Return IPFS CIDv0 without /ipfs/ prefix -ipfs name resolve /ipns/$(ipfs key list -l | grep ak-config | awk '{print $1}') | sed -e 's/\/ipfs\///' +ak-ipfs-name-resolve /ipns/$(ak-ipfs-key-list-full | grep ak-config | awk '{print $1}') | sed -e 's/\/ipfs\///' diff --git a/bin/ak-get-chain-minified b/bin/ak-get-chain-minified index 259cc36..d8c3fff 100755 --- a/bin/ak-get-chain-minified +++ b/bin/ak-get-chain-minified @@ -1 +1 @@ -enter | jq --compact-output +ak-enter | jq --compact-output diff --git a/bin/ak-get-ipfs-hashes-from-my-zchain b/bin/ak-get-ipfs-hashes-from-my-zchain index 3640cc5..4d60d13 100755 --- a/bin/ak-get-ipfs-hashes-from-my-zchain +++ b/bin/ak-get-ipfs-hashes-from-my-zchain @@ -1,2 +1,2 @@ #!/bin/bash -enter | jq -M | grep Qm | sed -e 's/{"zblock":"//g; s/",//; s/".*".*: "//g; s/"//g; s/{//g; s/://g; s/ //g' +ak-enter | jq -M | grep Qm | sed -e 's/{"zblock":"//g; s/",//; s/".*".*: "//g; s/"//g; s/{//g; s/://g; s/ //g' diff --git a/bin/ak-get-latest b/bin/ak-get-latest index e770d1c..36de493 100755 --- a/bin/ak-get-latest +++ b/bin/ak-get-latest @@ -1,2 +1,2 @@ #!/bin/bash -ipfs files stat /zlatest | head -n 1| tr -d '\n' +ak-ipfs-files-stat /zlatest | head -n 1| tr -d '\n' diff --git a/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain b/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain index 2b9f580..303d595 100755 --- a/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain +++ b/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain @@ -2,7 +2,7 @@ # Outputs all the "ipfs" values from the DATA blocks of our ZCHAIN if [ ! -z $1 ] then - enter $1 | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' + ak-enter $1 | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' else - enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' + ak-enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' fi diff --git a/bin/ak-get-only-ipfs-key-values-from-our-zchain b/bin/ak-get-only-ipfs-key-values-from-our-zchain index 8334f66..747bb55 100755 --- a/bin/ak-get-only-ipfs-key-values-from-our-zchain +++ b/bin/ak-get-only-ipfs-key-values-from-our-zchain @@ -1,3 +1,3 @@ #!/bin/bash # Outputs all the "ipfs" values from the DATA blocks of our ZCHAIN -enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' | sort | uniq +ak-enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' | sort | uniq diff --git a/bin/ak-ipfs-add b/bin/ak-ipfs-add new file mode 100755 index 0000000..5887b24 --- /dev/null +++ b/bin/ak-ipfs-add @@ -0,0 +1,3 @@ +#!/bin/bash + +ipfs add -Qr $1 diff --git a/bin/ak-ipfs-block-stat b/bin/ak-ipfs-block-stat new file mode 100755 index 0000000..54b6b40 --- /dev/null +++ b/bin/ak-ipfs-block-stat @@ -0,0 +1,3 @@ +#!/bin/bash + +ipfs block stat "$1" diff --git a/bin/ak-ipfs-cat b/bin/ak-ipfs-cat new file mode 100755 index 0000000..2c29458 --- /dev/null +++ b/bin/ak-ipfs-cat @@ -0,0 +1,2 @@ +#!/bin/bash +ipfs --timeout=10s cat $1 diff --git a/bin/ak-ipfs-check b/bin/ak-ipfs-check index 721693e..0ee3e3c 100755 --- a/bin/ak-ipfs-check +++ b/bin/ak-ipfs-check @@ -5,7 +5,7 @@ logit(){ } -ipfs files ls /zarchive > /dev/null +ak-ipfs-files-ls /zarchive > /dev/null if [ $? != 0 ] |