aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ak-articles27
-rwxr-xr-xbin/ak-data-expand34
-rwxr-xr-xbin/ak-enter60
-rwxr-xr-xbin/ak-files66
-rwxr-xr-xbin/ak-find-latest-mined-sblock22
-rwxr-xr-xbin/ak-folders28
-rwxr-xr-xbin/ak-ipfs-add2
-rwxr-xr-xbin/ak-ipfs-block-stat2
-rwxr-xr-xbin/ak-ipfs-cat2
-rwxr-xr-xbin/ak-ipfs-check26
-rwxr-xr-xbin/ak-ipfs-files-cp2
-rwxr-xr-xbin/ak-ipfs-files-ls2
-rwxr-xr-xbin/ak-ipfs-files-mkdir2
-rwxr-xr-xbin/ak-ipfs-files-mv2
-rwxr-xr-xbin/ak-ipfs-files-rm2
-rwxr-xr-xbin/ak-ipfs-files-stat2
-rwxr-xr-xbin/ak-ipfs-get4
-rwxr-xr-xbin/ak-ipfs-key-gen2
-rwxr-xr-xbin/ak-ipfs-key-list2
-rwxr-xr-xbin/ak-ipfs-key-list-full2
-rwxr-xr-xbin/ak-ipfs-name-publish2
-rwxr-xr-xbin/ak-ipfs-name-resolve2
-rwxr-xr-xbin/ak-ipfs-starter2
-rwxr-xr-xbin/ak-ipfs-swarm-peers2
-rwxr-xr-xbin/ak-ipns-resolve6
-rwxr-xr-xbin/ak-profile2
-rwxr-xr-xbin/ak-sm-filejoiner2
-rwxr-xr-xbin/ak-sm-files14
-rwxr-xr-xbin/ak-sm-filesplitter28
-rwxr-xr-xbin/ak-sm-merkle-tree40
-rwxr-xr-xbin/ak-stellar-get-participants10
-rwxr-xr-xbin/ak-tempassin8
-rwxr-xr-xbin/ak-transactions4
-rwxr-xr-xbin/ak-unfollow4
-rwxr-xr-xbin/ak-zblock-cache14
-rwxr-xr-xbin/ak-zblock-pack24
-rwxr-xr-xbin/ak-zblock-show4
-rwxr-xr-xbin/ak-zchain-rebase2
-rwxr-xr-xbin/ak-zchain-reset4
39 files changed, 244 insertions, 221 deletions
diff --git a/bin/ak-articles b/bin/ak-articles
index e6c45c4..9e7c7b4 100755
--- a/bin/ak-articles
+++ b/bin/ak-articles
@@ -1,7 +1,29 @@
#!/bin/bash
+
+PROGRAM=$(basename $0)
+descriptionString="Articles module for Arching Kaos"
+
+logit(){
+ ak-logthis "$PROGRAM" "$1" "$2"
+}
+new_line(){
+ printf '\n'
+}
+description(){
+ full_title="$(printf '%s - %s' "$PROGRAM" "$descriptionString")"
+ delimiter_count=`echo -n $full_title | wc -c`
+ printf '%s' "$full_title"
+ new_line
+ while [ $delimiter_count -gt 0 ]
+ do
+ printf '='
+ delimiter_count=$(($delimiter_count-1))
+ done
+ new_line
+}
+
ZARTICLESDIR="$AK_WORKDIR/articles"
TEMP="/tmp/aktmp"
-echo $ZARTICLESDIR
if [ ! -d $ZARTICLESDIR ]; then
mkdir $ZARTICLESDIR
cd $ZARTICLESDIR
@@ -47,8 +69,7 @@ _ak_modules_articles_index(){
done
}
_ak_modules_articles_title(){
- echo ak-articles-cli
- echo "--------------"
+ description
}
_ak_modules_articles_import(){
echo "#TODO"
diff --git a/bin/ak-data-expand b/bin/ak-data-expand
index 862fa75..d13233d 100755
--- a/bin/ak-data-expand
+++ b/bin/ak-data-expand
@@ -5,94 +5,94 @@ then
mkdir $AK_WORKDIR/ipfs
fi
logit(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
if [ ! -z "$1" ] && [ ! -z "$2" ]
then
echo -n "$1" | grep -e 'Qm.\{44\}' >/dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Invalid hash format for $1"
+ logit "ERROR" "Invalid hash format for $1"
exit 1
fi
ak-ipfs-cat $1 > /dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while reading $1"
+ logit "ERROR" "Error while reading $1"
exit 1
fi
ak-ipfs-cat $1 | jq -M > /dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while parsing JSON for $1"
+ logit "ERROR" "Error while parsing JSON for $1"
exit 1
fi
ak-ipfs-cat $1 | jq | grep ipfs > /dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while extracting data from JSON for $1"
+ logit "ERROR" "Error while extracting data from JSON for $1"
exit 1
fi
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"
+ logit "ERROR" "Error while extracting data from JSON for $1"
exit 1
fi
ak-ipfs-cat $1 | jq | grep detach > /dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while extracting data from JSON for $1"
+ logit "ERROR" "Error while extracting data from JSON for $1"
exit 1
fi
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"
+ logit "ERROR" "Error while extracting data from JSON for $1"
exit 1
fi
echo -n "$2" | grep -e 'Qm.\{44\}' >/dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Invalid hash format for $2"
+ logit "ERROR" "Invalid hash format for $2"
exit 1
fi
gpg="$2"
ak-ipfs-get $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not get GPG key: $gpg"
+ logit "ERROR" "Could not get GPG key: $gpg"
exit 1
fi
gpg2 --homedir $AK_GPGHOME --import $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not import GPG key: $gpg"
+ logit "ERROR" "Could not import GPG key: $gpg"
exit 1
fi
ak-ipfs-get $DETACH > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while getting signature: $DETACH for data: $DATA"
+ logit "ERROR" "Error while getting signature: $DETACH for data: $DATA"
exit 1
fi
mv $DETACH $DATA.asc
- logit "[INFO]" "Block signature downloaded"
+ logit "INFO" "Block signature downloaded"
ak-ipfs-get $DATA > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while getting data: $DATA"
+ logit "ERROR" "Error while getting data: $DATA"
exit 1
fi
- logit "[INFO]" "Data downloaded: $DATA"
+ logit "INFO" "Data downloaded: $DATA"
gpg2 --homedir $AK_GPGHOME --verify $DATA.asc $DATA > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while verifying signature for $DATA"
+ logit "ERROR" "Error while verifying signature for $DATA"
exit 1
fi
mv $DATA $AK_WORKDIR/ipfs
- logit "[INFO]" "Block signature verified"
+ logit "INFO" "Block signature verified"
echo -n '"data":"'$1'","'$1'":'$(ak-ipfs-cat $1|jq -M -c)','
exit 0
else
diff --git a/bin/ak-enter b/bin/ak-enter
index 3313329..92a434d 100755
--- a/bin/ak-enter
+++ b/bin/ak-enter
@@ -20,7 +20,7 @@
PROGRAM="$(basename $0)"
logit(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
usage(){
@@ -45,7 +45,7 @@ isIPFSv0 () {
echo $1 | grep -e 'Qm.\{44\}' > /dev/null
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Argument provided was not an IPFS CIDv0 string"
+ logit "ERROR" "Argument provided was not an IPFS CIDv0 string"
exit 1
fi
else
@@ -84,7 +84,7 @@ while [ "$#" ]; do
entrance="$(ak-ipns-resolve $1)"
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not resolve IPNS name"
+ logit "ERROR" "Could not resolve IPNS name"
exit 1
fi
shift
@@ -135,7 +135,7 @@ do
# Reset timestamp since it's introduced later
timestamp=''
# Announce to logs which ZBLOCK is being read at the moment
- logit "[INFO]" "Examining $zblock"
+ logit "INFO" "Examining $zblock"
isIPFSv0 "$zblock"
@@ -143,23 +143,23 @@ do
ak-ipfs-cat $zblock | jq -c -M > $AK_ZBLOCKDIR/$zblock
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "ZBLOCK $zblock READ failed"
+ logit "ERROR" "ZBLOCK $zblock READ failed"
exit 1
fi
- logit "[INFO]" "ZBLOCK $zblock READ"
+ logit "INFO" "ZBLOCK $zblock READ"
echo -n '{'
# echo -n '"id":"'$counter'",'
echo -n '"zblock":"'$zblock'",'
-
+
# If it's JSON formated
cat $AK_ZBLOCKDIR/$zblock | jq -M > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "ZBLOCK $zblock is not JSON"
+ logit "ERROR" "ZBLOCK $zblock is not JSON"
cat /dev/null > $AK_ZBLOCKDIR/$zblock > /dev/null 2>&1
exit 1
fi
- logit "[INFO]" "ZBLOCK $zblock is JSON"
+ logit "INFO" "ZBLOCK $zblock is JSON"
# Be sure that there are the expected values
# We need 'block' and 'block_signature' inside a 'zblock'
@@ -167,20 +167,20 @@ do
block="$(cat $AK_ZBLOCKDIR/$zblock | jq -M -r .block)"
if [ "$block" == "null" ]
then
- logit "[ERROR]" "ZBLOCK $zblock has no block"
+ logit "ERROR" "ZBLOCK $zblock has no block"
exit 1
fi
isIPFSv0 "$block"
- logit "[INFO]" "ZBLOCK $zblock has block"
+ logit "INFO" "ZBLOCK $zblock has block"
block_signature="$(cat $AK_ZBLOCKDIR/$zblock | jq -M -r .block_signature)"
if [ "$block_signature" == "null" ]
then
- logit "[ERROR]" "ZBLOCK $zblock doesn't contain a block_signature"
+ logit "ERROR" "ZBLOCK $zblock doesn't contain a block_signature"
exit 1
fi
isIPFSv0 "$block_signature"
- logit "[INFO]" "ZBLOCK $zblock contains a block_signature"
+ logit "INFO" "ZBLOCK $zblock contains a block_signature"
# Same as above applies to BLOCK and DATA subparts of each ZBLOCK
# BLOCKS
@@ -189,24 +189,24 @@ do
cat $AK_BLOCKDIR/$block | jq -M > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "BLOCK $block READ failed"
+ logit "ERROR" "BLOCK $block READ failed"
exit 1
fi
grep -e 'timestamp' -e 'gpg' -e 'data' -e 'action' -e 'detach' -e 'previous' $AK_BLOCKDIR/$block > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "BLOCK $block is NOT a valid block"
+ logit "ERROR" "BLOCK $block is NOT a valid block"
exit 1
fi
- logit "[INFO]" "BLOCK $block is a block"
+ logit "INFO" "BLOCK $block is a block"
action="$(cat $AK_BLOCKDIR/$block | jq -M -r .action)"
module="$(echo $action | sed -e 's/\// /g' | awk '{ print $1 }')"
- logit "[INFO]" "DATA is $module module."
+ logit "INFO" "DATA is $module module."
command="$(echo $action | sed -e 's/\// /g' | awk '{ print $2 }')"
- logit "[INFO]" "COMMAND is $command"
+ logit "INFO" "COMMAND is $command"
timestamp="$(cat $AK_BLOCKDIR/$block | jq -M -r .timestamp)"
if [ "$timestamp" != "null" ]
@@ -231,36 +231,36 @@ do
ak-ipfs-get $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not get GPG key: $gpg ."
+ logit "ERROR" "Could not get GPG key: $gpg ."
exit 1
fi
gpg2 --homedir $AK_GPGHOME --import $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not import GPG key: $gpg ."
+ logit "ERROR" "Could not import GPG key: $gpg ."
exit 1
fi
ak-ipfs-get $block_signature > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Error while getting $block_signature for $block"
+ logit "ERROR" "Error while getting $block_signature for $block"
exit 1
fi
mv $block_signature $block.asc
- logit "[INFO]" "Block signature downloaded"
+ logit "INFO" "Block signature downloaded"
ak-ipfs-get $block > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not get $block block"
+ logit "ERROR" "Could not get $block block"
exit 1
fi
- logit "[INFO]" "Downloaded block $block."
+ logit "INFO" "Downloaded block $block."
gpg2 --homedir $AK_GPGHOME --verify $block.asc > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Could not verify $block with GPG key $gpg."
+ logit "ERROR" "Could not verify $block with GPG key $gpg."
exit 1
fi
logit "[GPG]" "$gpg signature of $block is verified."
@@ -271,7 +271,7 @@ do
ak-data-expand $data $gpg
if [ "$?" -ne 0 ]
then
- logit "[ERROR]" "Failed on data signature verification [data: $data, gpg: $gpg, zblock: $zblock]"
+ logit "ERROR" "Failed on data signature verification [data: $data, gpg: $gpg, zblock: $zblock]"
exit 1
fi
@@ -286,15 +286,15 @@ do
previous="$(cat $AK_BLOCKDIR/$block | jq -M -r .previous)"
if [ -v $previous ]
then
- logit "[WARNING]" "Block $block has no previous zblock, appending pseudo genesis to exit with 2."
+ logit "WARNING" "Block $block has no previous zblock, appending pseudo genesis to exit with 2."
echo -n '"previous":"genesis"},{"genesis":"genesis"}]'
- logit "[INFO]" "Reached pseudo-genesis, counted $counter zblocks."
+ logit "INFO" "Reached pseudo-genesis, counted $counter zblocks."
exit 2
# Otherwise, we inform of the sequence
else
#echo "$zblock after $previous"
- logit "[INFO]" "Found a previous block for $zblock: $previous"
+ logit "INFO" "Found a previous block for $zblock: $previous"
echo -n '"previous":"'$previous'"}'
zblock=$previous
fi
@@ -311,7 +311,7 @@ do
elif [ "$zblock" == "$seed" ]
then
echo -n '{"genesis":"genesis"}]'
- logit "[INFO]" "Reached $seed, counted $counter zblocks."
+ logit "INFO" "Reached $seed, counted $counter zblocks."
exit 0
fi
# And finally, if nothing is there exit with error
diff --git a/bin/ak-files b/bin/ak-files
index 20083ab..299bf4a 100755
--- a/bin/ak-files
+++ b/bin/ak-files
@@ -4,21 +4,21 @@ ZFILESDIR="$AK_WORKDIR/files"
TEMP="/tmp/aktmp"
PROGRAM="$(basename $0)"
logit(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
if [ ! -d $ZFILESDIR ]; then
- mkdir $ZFILESDIR
- if [ $? == 0 ]
- then
- logit "[INFO]" "Folder $ZFILESDIR created!"
- else
- logit "[ERROR]" "Failed to create $ZFILESDIR folder"
- exit 1
- fi
- cd $ZFILESDIR
- git init
+ mkdir $ZFILESDIR
+ if [ $? == 0 ]
+ then
+ logit "INFO" "Folder $ZFILESDIR created!"
+ else
+ logit "ERROR" "Failed to create $ZFILESDIR folder"
+ exit 1
+ fi
+ cd $ZFILESDIR
+ git init
else
- logit "[INFO]" "$ZFILESDIR found!"
+ logit "INFO" "$ZFILESDIR found!"
fi
_ak_modules_files_usage(){
@@ -35,47 +35,47 @@ main(){
FILENAME="$1"
CRP="$2"
echo "Adding $FILENAME"
- logit "[INFO]" "Switching to tmp folder..."
+ logit "INFO" "Switching to tmp folder..."
TEMPASSIN="$(ak-tempassin)"
cd $TEMPASSIN
if [ $? == 0 ]; then
- logit "[INFO]" "Success"
+ logit "INFO" "Success"
else
- logit "[ERROR]" "Error with tmp folder"
- exit 5
+ logit "ERROR" "Error with tmp folder"
+ exit 5
fi
- logit "[INFO]" "Copying $1 to $TEMPASSIN"
+ logit "INFO" "Copying $1 to $TEMPASSIN"
cp $2/$1 $TEMPASSIN/$1
if [ $? == 0 ]; then
- logit "[INFO]" "Copied successfully"
+ logit "INFO" "Copied successfully"
else
- logit "[ERROR]" "Error copying..."
+ logit "ERROR" "Error copying..."
fi
FILE="$TEMPASSIN/$1"
- logit "[INFO]" "Adding $FILE to IPFS..."
+ logit "INFO" "Adding $FILE to IPFS..."
FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
if [ $? == 0 ]; then
- logit "[INFO]" "Added $FILE to IPFS"
+ logit "INFO" "Added $FILE to IPFS"
else
- logit "[ERROR]" "Error in adding the $FILE to IPFS"
+ logit "ERROR" "Error in adding the $FILE to IPFS"
fi
- logit "[INFO]" "Signing..."
+ logit "INFO" "Signing..."
SIGN_FILE=$FILENAME".asc"
gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILE
if [ $? == 0 ]; then
- logit "[INFO]" "Signed"
+ logit "INFO" "Signed"
else
- logit "[ERROR]" "Error while signing"
+ logit "ERROR" "Error while signing"
fi
- logit "[INFO]" "Adding signature to IPFS"
+ logit "INFO" "Adding signature to IPFS"
SIGNATURE=$(ak-ipfs-add $TEMPASSIN/$SIGN_FILE)
if [ $? == 0 ]; then
- logit "[INFO]" "Added"
+ logit "INFO" "Added"
else
- logit "[ERROR]" "Error while adding"
+ logit "ERROR" "Error while adding"
fi
cat > $TEMPASSIN/data <<EOF
@@ -102,10 +102,10 @@ echo "Publishing..."
}
if [ ! -z $1 ]; then
- case $1 in
- help) _ak_modules_files_usage; exit;;
- add) _ak_modules_files_add $2; exit;;
- *) _ak_modules_files_usage; exit;;
- esac
+ case $1 in
+ -h | --help) _ak_modules_files_usage; exit;;
+ add) _ak_modules_files_add $2; exit;;
+ *) _ak_modules_files_usage; exit;;
+ esac
else _ak_modules_files_usage
fi
diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock
index b98214c..c3d9e33 100755
--- a/bin/ak-find-latest-mined-sblock
+++ b/bin/ak-find-latest-mined-sblock
@@ -4,18 +4,18 @@ cd $MINED_BLOCKS_DIR
PROGRAM="$(basename $0)"
declare -A counters
logitnowint(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
further(){
- # logitnowint "[INFO]" "Diving into $1"
+ # logitnowint "INFO" "Diving into $1"
lookfor $1
}
lookfor(){
- echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null
+ echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null
if [ ! $? = 0 ]
then
- logitnowint "[ERROR]" "Oops!!! The argument passed, does not match the regular expression!"
+ logitnowint "ERROR" "Oops!!! The argument passed, does not match the regular expression!"
else
counters[$CHAIN_PARENT]="$(expr ${counters[$CHAIN_PARENT]} + 1)"
if [ ! $? = 0 ]
@@ -23,22 +23,22 @@ lookfor(){
echo "$1, $counters[$1]"
exit 1
fi
- logitnowint "[INFO]" "Accessing file: $1"
+ logitnowint "INFO" "Accessing file: $1"
# echo "$1 file:"
# cat "$1" | jq
NEXT_TARGET="$(cat "$1" | jq | grep previous | tr -d ' ' | sed -e 's/previous//g; s/[",:]//g;')"
if [ ! "$NEXT_TARGET" = "" ]
then
- logitnowint "[INFO]" "Found previous: $NEXT_TARGET"
+ logitnowint "INFO" "Found previous: $NEXT_TARGET"
if [ ! -f "$NEXT_TARGET" ]
then
- logitnowint "[WARNING]" "Could not find $NEXT_TARGET"
+ logitnowint "WARNING" "Could not find $NEXT_TARGET"
else
further "$NEXT_TARGET"
fi
else
- logitnowint "[WARNING]" "No next target found. So long for $1"
+ logitnowint "WARNING" "No next target found. So long for $1"
fi
fi
}
@@ -50,12 +50,12 @@ do
# if [ ! "$p" = "" ] && [ ! "$p" = "tmplistblock" ]
if [ "$(echo $p | tr -d '\n' | wc -c)" = 128 ]
then
- logitnowint "[INFO]" "Investigating $p..."
+ logitnowint "INFO" "Investigating $p..."
export CHAIN_PARENT="$p"
counters[$CHAIN_PARENT]=1
lookfor "$p"
else
- logitnowint "[WARNING]" "Nothing to do with $p"
+ logitnowint "WARNING" "Nothing to do with $p"
fi
done < tmplistblock
rm tmplistblock
@@ -68,7 +68,7 @@ do
then
max="${counters[${value}]}"
max_holder="${value}"
- logitnowint "[INFO]" "New MAX $max on $max_holder"
+ logitnowint "INFO" "New MAX $max on $max_holder"
fi
diff --git a/bin/ak-folders b/bin/ak-folders
index 2a28dd9..280af2b 100755
--- a/bin/ak-folders
+++ b/bin/ak-folders
@@ -5,21 +5,24 @@ ZFOLDERSDIR="$AK_WORKDIR/folders"
TEMP="/tmp/aktmp"
logit(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
if [ ! -d $ZFOLDERSDIR ]; then
mkdir $ZFOLDERSDIR
- cd $ZFOLDERSDIR
+ logit "ERROR" "error $ZFOLDERSDIR not found or/and could not be created"
else
- logit "[ERROR]" "error $ZFOLDERSDIR not found or/and could not be created"
+ logit "INFO" "Found $ZFOLDERSDIR"
+ exit 1
fi
TEMPASSIN="$(ak-tempassin)"
cd $TEMPASSIN
_ak_modules_folders_usage(){
_ak_modules_folders_title
- echo "$PROGRAM - folder"
+ echo ""
+ echo " -h, --help Show this message"
+ echo " add <folder> Try ak-folders add <folder>"
}
_ak_modules_folders_add(){
@@ -33,24 +36,24 @@ _ak_modules_folders_main(){
FOLDERNAME="$1"
CRP="$2"
echo "Adding $FOLDERNAME"
- logit "[INFO]" "Copying $1 to temporary folder"
+ logit "INFO" "Copying $1 to temporary folder"
cp -r $2/$1 $1
if [ $? == 0 ]; then
- logit "[INFO]" "Copied successfully"
+ logit "INFO" "Copied successfully"
else
- logit "[ERROR]" "Error copying..."
+ logit "ERROR" "Error copying..."
fi
FOLDER="$1"
- logit "[INFO]" "Adding $FOLDER to IPFS..."
+ logit "INFO" "Adding $FOLDER to IPFS..."
FOLDER_IPFS_HASH=$(ak-ipfs-add $FOLDER)
if [ $? == 0 ]; then
- logit "[INFO]" "done"
+ logit "INFO" "done"
else
- logit "[ERROR]" "error"
+ logit "ERROR" "error"
fi
- logit "[WARNING]" "Folders are not signing..."
+ logit "WARNING" "Folders are not signing..."
printf '{"timestamp":"%s","foldername":"%s","ipfs":"%s"}' $(date -u +%s) $FOLDERNAME $FOLDER_IPFS_HASH
@@ -69,8 +72,7 @@ _ak_modules_folders_main(){
}
_ak_modules_folders_title(){
- echo "$PROGRAM"
- echo "Folder block creator"
+ echo "$PROGRAM - Folder block creator"
}
diff --git a/bin/ak-ipfs-add b/bin/ak-ipfs-add
index 63862b7..4cedcec 100755
--- a/bin/ak-ipfs-add
+++ b/bin/ak-ipfs-add
@@ -5,6 +5,6 @@ PROGRAM="$(basename $0)"
ipfs add -Qr "$1"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to add $1"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to add $1"
exit 1
fi
diff --git a/bin/ak-ipfs-block-stat b/bin/ak-ipfs-block-stat
index 144523d..b049a70 100755
--- a/bin/ak-ipfs-block-stat
+++ b/bin/ak-ipfs-block-stat
@@ -3,6 +3,6 @@ PROGRAM="$(basename $0)"
ipfs block stat "$1"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to retrieve stat of block $1"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to retrieve stat of block $1"
exit 1
fi
diff --git a/bin/ak-ipfs-cat b/bin/ak-ipfs-cat
index d2415e4..2adf00e 100755
--- a/bin/ak-ipfs-cat
+++ b/bin/ak-ipfs-cat
@@ -3,7 +3,7 @@ PROGRAM="$(basename $0)"
ipfs --timeout=10s cat $1
if [ "$?" -ne "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to cat $1"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to cat $1"
exit 1
fi
diff --git a/bin/ak-ipfs-check b/bin/ak-ipfs-check
index d54f5fc..30ebf4d 100755
--- a/bin/ak-ipfs-check
+++ b/bin/ak-ipfs-check
@@ -1,38 +1,38 @@
#!/bin/bash
PROGRAM="$(basename $0)"
logit(){
- ak-logthis "<$PROGRAM>" "$1" "$2"
+ ak-logthis "$PROGRAM" "$1" "$2"
}
ak-ipfs-files-ls /zarchive > /dev/null
if [ $? != 0 ]
then
- logit "[ERROR]" "/zarchive is missing"
-else
- logit "[INFO]" "/zarchive OK"
+ logit "ERROR" "/zarchive is missing"
+else
+ logit "INFO" "/zarchive OK"
fi
ak-ipfs-files-ls /zlatest > /dev/null
if [ $? != 0 ]
then
- logit "[ERROR]" "/zlatest is missing"
+ logit "ERROR" "/zlatest is missing"
else
- logit "[INFO]" "/zlatest is OK"
+ logit "INFO" "/zlatest is OK"
fi
ak-ipfs-key-list | grep zchain > /dev/null
if [ $? != 0 ]; then
- logit "[WARNING]" "zchain key is missing"
+ logit "WARNING" "zchain key is missing"
ak-ipfs-key-gen zchain > $ZCHAIN
if [ $? != 0 ]; then
- logit "[ERROR]" "zchain fails to create"
+ logit "ERROR" "zchain fails to create"
else
- logit "[INFO]" "zchain created"
+ logit "INFO" "zchain created"
fi
else
- logit "[INFO]" "zchain is there"
+ logit "INFO" "zchain is there"
fi
ak-ipfs-key-list | grep ak-config > /dev/null
@@ -40,10 +40,10 @@ if [ $? != 0 ]; then
logit "WARNING" "ak-config key is missing"
ak-ipfs-key-gen ak-config
if [ $? != 0 ]; then
- logit "[ERROR]" "ak-config fails to create"
+ logit "ERROR" "ak-config fails to create"
else
- logit "[INFO]" "ak-config created"
+ logit "INFO" "ak-config created"
fi
else
- logit "[INFO]" "ak-config is there"
+ logit "INFO" "ak-config is there"
fi
diff --git a/bin/ak-ipfs-files-cp b/bin/ak-ipfs-files-cp
index 6ae766e..37a878a 100755
--- a/bin/ak-ipfs-files-cp
+++ b/bin/ak-ipfs-files-cp
@@ -3,6 +3,6 @@ PROGRAM="$(basename $0)"
ipfs files cp "$1" "$2"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to copy $1 to $2"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to copy $1 to $2"
exit 1
fi
diff --git a/bin/ak-ipfs-files-ls b/bin/ak-ipfs-files-ls
index 26a3313..80fc899 100755
--- a/bin/ak-ipfs-files-ls
+++ b/bin/ak-ipfs-files-ls
@@ -3,6 +3,6 @@ PROGRAM="$(basename $0)"
ipfs files ls "$1"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to list $1"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to list $1"
exit 1
fi
diff --git a/bin/ak-ipfs-files-mkdir b/bin/ak-ipfs-files-mkdir
index 6406b33..d6fb298 100755
--- a/bin/ak-ipfs-files-mkdir
+++ b/bin/ak-ipfs-files-mkdir
@@ -3,6 +3,6 @@ PROGRAM="$(basename $0)"
ipfs files mkdir "$1"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to mkdir $1"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to mkdir $1"
exit 1
fi
diff --git a/bin/ak-ipfs-files-mv b/bin/ak-ipfs-files-mv
index 8b64dba..67fa9b0 100755
--- a/bin/ak-ipfs-files-mv
+++ b/bin/ak-ipfs-files-mv
@@ -3,6 +3,6 @@ PROGRAM="$(basename $0)"
ipfs files mv "$1" "$2"
if [ "$?" != "0" ]
then
- ak-logthis "<$PROGRAM>" "[ERROR]" "Failed to move $1 to $2"
+ ak-logthis "$PROGRAM" "ERROR" "Failed to move $1 to $2"
exit 1
fi
diff --git a/bin/ak-ipfs-files-rm b/bin/ak-ipfs-files-rm
index 490103e..cd5cb02 100755
--- a/