aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ak-articles7
-rwxr-xr-xbin/ak-categories7
-rwxr-xr-xbin/ak-comments7
-rwxr-xr-xbin/ak-config7
-rwxr-xr-xbin/ak-data-expand21
-rwxr-xr-xbin/ak-enter13
-rwxr-xr-xbin/ak-files5
-rwxr-xr-xbin/ak-folders3
-rwxr-xr-xbin/ak-follow3
-rwxr-xr-xbin/ak-get-zlatest3
-rwxr-xr-xbin/ak-ipfs-daemon7
-rwxr-xr-xbin/ak-ipfs-starter7
-rwxr-xr-xbin/ak-mempool9
-rwxr-xr-xbin/ak-mixtapes5
-rwxr-xr-xbin/ak-news29
-rwxr-xr-xbin/ak-node-info5
-rwxr-xr-xbin/ak-profile9
-rwxr-xr-xbin/ak-reference7
-rwxr-xr-xbin/ak-repositories24
-rwxr-xr-xbin/ak-sm-files5
-rwxr-xr-xbin/ak-todos7
-rwxr-xr-xbin/ak-transactions5
-rwxr-xr-xbin/ak-unfollow6
-rwxr-xr-xbin/ak-zblock-announce14
-rwxr-xr-xbin/ak-zblock-gen-html13
-rwxr-xr-xbin/ak-zblock-manipulator29
-rwxr-xr-xbin/ak-zblock-pack26
-rwxr-xr-xbin/ak-zchain-calculate-size3
-rwxr-xr-xbin/ak-zchain-chk7
-rwxr-xr-xbin/ak-zchain-rebase11
-rwxr-xr-xbin/ak-zchain-reset12
-rwxr-xr-xlib/_ak_ipfs283
32 files changed, 467 insertions, 132 deletions
diff --git a/bin/ak-articles b/bin/ak-articles
index 9a9f462..ba45309 100755
--- a/bin/ak-articles
+++ b/bin/ak-articles
@@ -5,6 +5,7 @@ descriptionString="Articles module for Arching Kaos"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
ZARTICLESDIR="$AK_WORKDIR/articles"
@@ -35,7 +36,7 @@ _ak_modules_articles_create(){
logit "INFO" "Renaming..."
TITLE="$(head -n 1 $ARTICLES_FILE)"
TO_FILE=$ARTICLES_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
- IPFS_FILE=$(ak-ipfs-add $ARTICLES_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $ARTICLES_FILE)
mv $ARTICLES_FILE $ZARTICLESDIR/$TO_FILE
sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZARTICLESDIR/README
_ak_modules_articles_add $ZARTICLESDIR/$TO_FILE
@@ -90,10 +91,10 @@ _ak_modules_articles_add(){
echo "Adding articles from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
TITLE=$(head -n 1 $FILE)
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$DATETIME",
diff --git a/bin/ak-categories b/bin/ak-categories
index 9387651..6f2da6c 100755
--- a/bin/ak-categories
+++ b/bin/ak-categories
@@ -5,6 +5,7 @@ descriptionString="A module for adding and refering zblocks to categories"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
if [ ! -d $AK_CATEGORIES ]; then
@@ -23,7 +24,7 @@ _ak_modules_categories_create(){
logit "INFO" "Renaming..."
TITLE="$(head -n 1 $NEWS_FILE)"
TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
- IPFS_FILE=$(ak-ipfs-add $NEWS_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $NEWS_FILE)
mv $NEWS_FILE $AK_CATEGORIES/$TO_FILE
sed -e 's,Qm.*,'"$IPFS_FILE"',g' $AK_CATEGORIES/README
_ak_modules_categories_add $AK_CATEGORIES/$TO_FILE
@@ -74,10 +75,10 @@ _ak_modules_categories_add(){
logit "INFO" "Adding news from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
TITLE=$(head -n 1 $FILE)
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$DATETIME",
diff --git a/bin/ak-comments b/bin/ak-comments
index 6a4bb03..220b1a7 100755
--- a/bin/ak-comments
+++ b/bin/ak-comments
@@ -4,6 +4,7 @@ descriptionString="Comments module for Arching Kaos"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
ZCOMMENTSDIR="$AK_WORKDIR/comments"
@@ -31,7 +32,7 @@ _ak_modules_comments_create(){
vi $COMMENTS_FILE
echo "Renaming..."
TO_FILE=$COMMENTS_FILE
- IPFS_FILE=$(ak-ipfs-add $COMMENTS_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $COMMENTS_FILE)
mv $COMMENTS_FILE $ZCOMMENTSDIR/$TO_FILE
_ak_modules_comments_add $TO_FILE
logit "INFO" "Adding to git repo..."
@@ -63,10 +64,10 @@ _ak_modules_comments_add(){
FILE=$ZCOMMENTSDIR/$1
echo "Adding comments from " $FILE
DATETIME="$1"
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
printf '{"datetime":"%s","ipfs":"%s","detach":"%s"}' $DATETIME $FILE_IPFS_HASH $FILE_SIGNATURE > data
else
echo "File $FILE doesn't exist";
diff --git a/bin/ak-config b/bin/ak-config
index 8e2df7b..1fe4d8d 100755
--- a/bin/ak-config
+++ b/bin/ak-config
@@ -3,6 +3,7 @@ PROGRAM="$(basename $0)"
descriptionString="Arching Kaos Configuration Tool"
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
_ak_config_title(){
description
@@ -25,7 +26,7 @@ _ak_config_show(){
# We will be using our public key also to put it in the block later
KEY="tmp-gpg.pub"
gpg2 --homedir $AK_GPGHOME --armour --output $KEY --export $AK_FINGERPRINT
- GPG_PUB_KEY=$(ak-ipfs-add $KEY)
+ GPG_PUB_KEY=$(_ak_ipfs_add $KEY)
rm $KEY
echo '
@@ -45,7 +46,7 @@ _ak_config_publish(){
then
ipfs key gen ak-config
fi
- ak-ipfs-name-publish --key=ak-config /ipfs/$(ak-ipfs-add 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"
@@ -56,7 +57,7 @@ _ak_config_publish(){
}
_ak_config_published(){
- ak-ipfs-cat $(ak-node-info ipfs) | jq -c
+ _ak_ipfs_cat $(ak-node-info ipfs) | jq -c
}
if [ ! -z $1 ]; then
diff --git a/bin/ak-data-expand b/bin/ak-data-expand
index 0a82e63..e5e699f 100755
--- a/bin/ak-data-expand
+++ b/bin/ak-data-expand
@@ -1,6 +1,7 @@
#!/bin/bash
PROGRAM="$(basename $0)"
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
if [ ! -d $AK_WORKDIR/ipfs ]
@@ -16,37 +17,37 @@ then
logit "ERROR" "Invalid hash format for $1"
exit 1
fi
- ak-ipfs-cat $1 > /dev/null
+ _ak_ipfs_cat $1 > /dev/null
if [ "$?" -ne 0 ]
then
logit "ERROR" "Error while reading $1"
exit 1
fi
- ak-ipfs-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
- ak-ipfs-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="$(ak-ipfs-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
- ak-ipfs-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="$(ak-ipfs-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"
@@ -59,7 +60,7 @@ then
exit 1
fi
gpg="$2"
- ak-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"
@@ -71,7 +72,7 @@ then
logit "ERROR" "Could not import GPG key: $gpg"
exit 1
fi
- ak-ipfs-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"
@@ -79,7 +80,7 @@ then
fi
mv $DETACH $DATA.asc
logit "INFO" "Block signature downloaded"
- ak-ipfs-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"
@@ -94,7 +95,7 @@ then
fi
mv $DATA $AK_WORKDIR/ipfs
logit "INFO" "Block signature verified"
- echo -n '"data":"'$1'","'$1'":'$(ak-ipfs-cat $1|jq -M -c)','
+ echo -n '"data":"'$1'","'$1'":'$(_ak_ipfs_cat $1|jq -M -c)','
exit 0
else
echo "Usage: $PROGRAM HASH GPG"
diff --git a/bin/ak-enter b/bin/ak-enter
index 01a93f9..9d9efc5 100755
--- a/bin/ak-enter
+++ b/bin/ak-enter
@@ -21,6 +21,7 @@ PROGRAM="$(basename $0)"
descriptionString="Crawl an arching kaos chain"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
_ak_enter_title(){
@@ -143,7 +144,7 @@ do
isIPFSv0 "$zblock"
# We check if any $zblock at all
- ak-ipfs-cat $zblock | jq -c -M > $AK_ZBLOCKDIR/$zblock
+ _ak_ipfs_cat $zblock | jq -c -M > $AK_ZBLOCKDIR/$zblock
if [ "$?" -ne 0 ]
then
logit "ERROR" "ZBLOCK $zblock READ failed"
@@ -188,7 +189,7 @@ do
# Same as above applies to BLOCK and DATA subparts of each ZBLOCK
# BLOCKS
echo -n '"block":"'$block'",'
- ak-ipfs-cat $block | jq -c -M > $AK_BLOCKDIR/$block
+ _ak_ipfs_cat $block | jq -c -M > $AK_BLOCKDIR/$block
cat $AK_BLOCKDIR/$block | jq -M > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
@@ -231,7 +232,7 @@ do
if [ $verify == 1 ]
then
- ak-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 ."
@@ -243,7 +244,7 @@ do
logit "ERROR" "Could not import GPG key: $gpg ."
exit 1
fi
- ak-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"
@@ -252,7 +253,7 @@ do
mv $block_signature $block.asc
logit "INFO" "Block signature downloaded"
- ak-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"
@@ -280,7 +281,7 @@ do
# DATA
# Only print to stdout
- # ak-ipfs-cat $data
+ # _ak_ipfs_cat $data
touch $AK_DATADIR/$data
# Now, since we sourced the BLOCK to our terminal, we can search
diff --git a/bin/ak-files b/bin/ak-files
index c4d6f2c..7cdedcd 100755
--- a/bin/ak-files
+++ b/bin/ak-files
@@ -4,6 +4,7 @@ ZFILESDIR="$AK_WORKDIR/files"
TEMP="/tmp/aktmp"
PROGRAM="$(basename $0)"
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
if [ ! -d $ZFILESDIR ]; then
@@ -55,7 +56,7 @@ main(){
FILE="$TEMPASSIN/$1"
logit "INFO" "Adding $FILE to IPFS..."
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
if [ $? == 0 ]; then
logit "INFO" "Added $FILE to IPFS"
else
@@ -71,7 +72,7 @@ main(){
fi
logit "INFO" "Adding signature to IPFS"
- SIGNATURE=$(ak-ipfs-add $TEMPASSIN/$SIGN_FILE)
+ SIGNATURE=$(_ak_ipfs_add $TEMPASSIN/$SIGN_FILE)
if [ $? == 0 ]; then
logit "INFO" "Added"
else
diff --git a/bin/ak-folders b/bin/ak-folders
index b5f2601..2651571 100755
--- a/bin/ak-folders
+++ b/bin/ak-folders
@@ -5,6 +5,7 @@ ZFOLDERSDIR="$AK_WORKDIR/folders"
TEMP="/tmp/aktmp"
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
if [ ! -d $ZFOLDERSDIR ]; then
mkdir $ZFOLDERSDIR
@@ -45,7 +46,7 @@ _ak_modules_folders_main(){
FOLDER="$1"
logit "INFO" "Adding $FOLDER to IPFS..."
- FOLDER_IPFS_HASH=$(ak-ipfs-add $FOLDER)
+ FOLDER_IPFS_HASH=$(_ak_ipfs_add $FOLDER)
if [ $? == 0 ]; then
logit "INFO" "done"
else
diff --git a/bin/ak-follow b/bin/ak-follow
index e0e7336..dea706f 100755
--- a/bin/ak-follow
+++ b/bin/ak-follow
@@ -2,6 +2,7 @@
FOLLOWING="$HOME/.arching-kaos/following"
PROGRAM="$(basename $0)"
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
if [ ! -z $1 ]
then
@@ -12,7 +13,7 @@ then
exit 1
fi
echo $1 >> $FOLLOWING
- IPFS=$(ak-ipfs-add $FOLLOWING)
+ IPFS=$(_ak_ipfs_add $FOLLOWING)
if [ $? != 0 ]
then
logit "ERROR" "Addition failed"
diff --git a/bin/ak-get-zlatest b/bin/ak-get-zlatest
index 36de493..64085fd 100755
--- a/bin/ak-get-zlatest
+++ b/bin/ak-get-zlatest
@@ -1,2 +1,3 @@
#!/bin/bash
-ak-ipfs-files-stat /zlatest | head -n 1| tr -d '\n'
+source $AK_LIBDIR/_ak_ipfs
+_ak_ipfs_files_stat /zlatest | head -n 1| tr -d '\n'
diff --git a/bin/ak-ipfs-daemon b/bin/ak-ipfs-daemon
new file mode 100755
index 0000000..ad0565d
--- /dev/null
+++ b/bin/ak-ipfs-daemon
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+PROGRAM="$(basename $0)"
+
+
+source $AK_LIBDIR/_ak_ipfs
+_ak_ipfs daemon
diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter
index b067259..3685736 100755
--- a/bin/ak-ipfs-starter
+++ b/bin/ak-ipfs-starter
@@ -1,8 +1,11 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-screen -dmS ipfs-daemon ipfs daemon --routing=dht --migrate
+
+source $AK_LIBDIR/_ak_logit
+
+screen -dmS akipfsd ak-ipfs-daemon
if [ "$?" != "0" ]
then
- ak-logthis "$PROGRAM" "ERROR" "Failed to start IPFS daemon"
+ logit "ERROR" "Failed to start IPFS daemon"
exit 1
fi
diff --git a/bin/ak-mempool b/bin/ak-mempool
index 1baf4c8..51f59a7 100755
--- a/bin/ak-mempool
+++ b/bin/ak-mempool
@@ -5,13 +5,16 @@
# They also are a part of our swarm.
# So should we ask for our peers?
-ak-ipfs-swarm-peers > tmp_peers
+source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
+
+_ak_ipfs_swarm_peers > tmp_peers
while IFS="" read -r p || [ -n "$p" ]
do
peer="$(echo "$p" | sed -e 's/^.*\///')"
- echo "Peer $peer found! Examining..."
- ak-ipfs-cat /ipns/$peer/zlatest
+ logit "INFO" "Peer $peer found! Examining..."
+ _ak_ipfs_cat /ipns/$peer/zlatest
done < tmp_peers
rm tmp_peers
diff --git a/bin/ak-mixtapes b/bin/ak-mixtapes
index 242211d..6b70bf5 100755
--- a/bin/ak-mixtapes
+++ b/bin/ak-mixtapes
@@ -5,6 +5,7 @@ PROGRAM="$(basename $0)"
descriptionString="AK mixtape block creator"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
_ak_modules_mixtapes_usage(){
@@ -33,12 +34,12 @@ _ak_modules_mixtapes_specs(){
_ak_modules_mixtapes_main(){
echo $MIXTAPE_FILE "by" $MIXTAPE_ARTIST "named as" $MIXTAPE_TITLE
- MIXTAPE_IPFS_HASH=$(ak-ipfs-add $MIXTAPE_FILE)
+ MIXTAPE_IPFS_HASH=$(_ak_ipfs_add $MIXTAPE_FILE)
MIXTAPE_SIGN_FILE=$MIXTAPE_FILE".asc"
_ak_gpg_sign_detached $MIXTAPE_SIGN_FILE $MIXTAPE_FILE
- MIXTAPE_SIGNATURE=$(ak-ipfs-add $MIXTAPE_SIGN_FILE)
+ MIXTAPE_SIGNATURE=$(_ak_ipfs_add $MIXTAPE_SIGN_FILE)
cat > data <<EOF
{
diff --git a/bin/ak-news b/bin/ak-news
index 84458c8..4c42a5d 100755
--- a/bin/ak-news
+++ b/bin/ak-news
@@ -7,6 +7,7 @@ TEMP="/tmp/aktmp"
source $AK_LIBDIR/_ak_logit
source $AK_LIBDIR/_ak_script_description
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
if [ ! -d $ZNEWSDIR ]; then
@@ -32,7 +33,7 @@ _ak_modules_news_create(){
echo "Renaming..."
TITLE="$(head -n 1 $NEWS_FILE)"
TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
- IPFS_FILE=$(ak-ipfs-add $NEWS_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $NEWS_FILE)
mv $NEWS_FILE $ZNEWSDIR/$TO_FILE
sed -i -e 's,Qm.*,'"$IPFS_FILE"',g' $ZNEWSDIR/README
_ak_modules_news_add $TO_FILE
@@ -99,13 +100,13 @@ _ak_modules_news_add_from_file(){
cp $FILE $TEMP
FILE="$(basename $1)"
cd $TEMP
- echo "Adding news from " $FILE
+ logit "INFO" "Adding news from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
TITLE=$(head -n 1 $FILE)
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$DATETIME",
@@ -116,15 +117,15 @@ _ak_modules_news_add_from_file(){
}
EOF
else
- echo "File $FILE doesn't exist";
+ logit "ERROR" "File $FILE doesn't exist";
exit 2
fi
ak-zblock-pack "news/add" $(pwd)/data
if [ $? == 0 ]
then
- echo "News added successfully"
+ logit "INFO" "News added successfully"
else
- echo "error??"
+ logit "ERROR" "Failed to pack zblock"
exit 1
fi
rm -rf $TEMP
@@ -135,13 +136,13 @@ _ak_modules_news_add(){
cd $TEMP
if [ -f $ZNEWSDIR/$1 ]; then
FILE="$1"
- echo "Adding news from " $FILE
+ logit "INFO" "Adding news from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
TITLE=$(head -n 1 $ZNEWSDIR/$FILE)
- FILE_IPFS_HASH=$(ak-ipfs-add $ZNEWSDIR/$FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $ZNEWSDIR/$FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $ZNEWSDIR/$FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$DATETIME",
@@ -152,15 +153,15 @@ _ak_modules_news_add(){
}
EOF
else
- echo "File $FILE doesn't exist";
+ logit "ERROR" "File $1 doesn't exist";
exit 2
fi
ak-zblock-pack "news/add" $(pwd)/data
if [ $? == 0 ]
then
- echo "News added successfully"
+ logit "INFO" "News added successfully"
else
- echo "error??"
+ logit "ERROR" "error??"
exit 1
fi
}
@@ -193,7 +194,7 @@ _ak_modules_news_read(){
if [ "$module" == "news" ] && [ "$action" == "add" ]
then
- ak-ipfs-cat $linkToText
+ _ak_ipfs_cat $linkToText
else
logit "ERROR" "Not a news block."
echo "ERROR Not a news block."
diff --git a/bin/ak-node-info b/bin/ak-node-info
index 73217a0..1b12798 100755
--- a/bin/ak-node-info
+++ b/bin/ak-node-info
@@ -1,15 +1,16 @@
#!/bin/bash
PROGRAM="$(basename $0)"
+source $AK_LIBDIR/_ak_ipfs
# Resolves the IPNS key "ak-config" to its current IPFS value
# Return IPFS CIDv0 without /ipfs/ prefix
_ak_node_info_ipfs_hash(){
- ak-ipfs-name-resolve /ipns/$(_ak_node_info_ipns_key) | sed -e 's/\/ipfs\///'
+ _ak_ipfs_name_resolve /ipns/$(_ak_node_info_ipns_key) | sed -e 's/\/ipfs\///'
}
# Finds ak-config ipns key
# Returns IPNS key
_ak_node_info_ipns_key(){
- ak-ipfs-key-list-full | grep ak-config | awk '{print $1}'
+ _ak_ipfs_key_list_full | grep ak-config | awk '{print $1}'
}
_ak_node_info_usage(){
diff --git a/bin/ak-profile b/bin/ak-profile
index fa07fcb..02a9fe4 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -5,6 +5,7 @@ TEMP="/tmp/aktmp"
# Outputs to log file in the classic format :)
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
# Whatever the command is, we check if $ZPROFILEDIR is there.
@@ -26,7 +27,7 @@ _ak_modules_profile_show(){
if [ ! -z $1 ]
then
logit "INFO" "Working with $1"
- ak-ipfs-cat $(echo $(ak-ipfs-cat $1) | jq '.ipfs' -r)
+ _ak_ipfs_cat $(echo $(_ak_ipfs_cat $1) | jq '.ipfs' -r)
else
echo "No DATA provided"
exit 1
@@ -59,7 +60,7 @@ EOF
if [ $? == 0 ]
then
echo "Added successfully... proceeding"
- IPFS_FILE=$(ak-ipfs-add $ZPROPERTY_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $ZPROPERTY_FILE)
echo "Prop writting,,, $IPFS_FILE"
_ak_modules_profile_add $ZPROPERTY_KEY
cd $ZPROFILEDIR
@@ -152,10 +153,10 @@ _ak_modules_profile_add(){
if [ -f $ZPROFILEDIR/$1 ]; then
FILE="$ZPROFILEDIR/$1"
echo "Adding from " $FILE
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$(pwd)/$1".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$(date -u +%s)",
diff --git a/bin/ak-reference b/bin/ak-reference
index a1a800f..ee30ae3 100755
--- a/bin/ak-reference
+++ b/bin/ak-reference
@@ -2,6 +2,7 @@
ZREFERENCESDIR="$AK_WORKDIR/references"
TEMP="/tmp/aktmp"
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
echo $ZREFERENCESDIR
if [ ! -d $ZREFERENCESDIR ]; then
@@ -32,7 +33,7 @@ EOF
TO_FILE="$REFERENCEFILE-$REFERENCE-$REFER_TO"
mv $REFERENCEFILE $ZREFERENCESDIR/$TO_FILE
echo $TO_FILE
- IPFS_FILE=$(ak-ipfs-add $ZREFERENCESDIR/$TO_FILE)
+ IPFS_FILE=$(_ak_ipfs_add $ZREFERENCESDIR/$TO_FILE)
sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZREFERENCESDIR/README
_ak_modules_reference_add $ZREFERENCESDIR/$TO_FILE
cd $ZREFERENCESDIR
@@ -85,10 +86,10 @@ _ak_modules_reference_add(){
FILE="$1"
echo "Adding references from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
- FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILE)
FILE_SIGN_FILE=$FILE".asc"
_ak_gpg_sign_detached $FILE_SIGN_FILE $FILE
- FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE)
+ FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
"datetime":"$(date -u +%s)",
diff --git a/bin/ak-repositories b/bin/ak-repositories
index c148a81..8dc2652 100755
--- a/bin/ak-repositories
+++ b/bin/ak-repositories
@@ -18,9 +18,9 @@ import(){
then
cd $PROJECT.git
git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-key-gen "$PROJECT.git"
- ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
+ IPFS="$(_ak_ipfs_add .)"
+ _ak_ipfs_key_gen "$PROJECT.git"
+ _ak_ipfs_name_publish --key="$PROJECT.git" /ipfs/$IPFS
cd $HOME/bare
else
echo "$PROJECT not a git repo"
@@ -40,8 +40,8 @@ update(){
cd $BARE
git pull
git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-name-publish --key="$BARENAME" /ipfs/$IPFS
+ IPFS="$(_ak_ipfs_add .)"
+ _ak_ipfs_name_publish --key="$BARENAME" /ipfs/$IPFS
echo "DONE"
else
echo "NO BARE TO UPDATE"
@@ -55,8 +55,8 @@ update(){
cd "$PROJECT"
git pull
git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-name-publish --key="$PROJECT" /ipfs/$IPFS
+ IPFS="$(_ak_ipfs_add .)"
+ _ak_ipfs_name_publish --key="$PROJECT" /ipfs/$IPFS
cd $BAREDIR
done
fi
@@ -100,11 +100,11 @@ add(){
then
cd $BAREGITDIR
git repack -a
- IPFS="$(ak-ipfs-add .)"
- try=ak-ipfs-key-gen "$PROJECT.git"
+ IPFS="$(_ak_ipfs_add .)"
+ try=_ak_ipfs_key_gen "$PROJECT.git"
if [ $? == 0 ]
then
- ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
+ _ak_ipfs_name_publish --key="$PROJECT.git" /ipfs/$IPFS
printf '{"project":"%s.git","ipns":"%s"}' $PROJECT $try > data
ak-zblock-pack "repos/add" $PWD/data
echo "Done"
@@ -116,11 +116,11 @@ add(){
}
index(){
- ak-ipfs-key-list-full | grep -e '\.git'
+ _ak_ipfs_key_list_full | grep -e '\.git'
}
set-as-profile(){
- IPFS=$(ak-ipfs-add $REPOSTORE)
+ IPFS=$(_ak_ipfs_add $REPOSTORE)
if [ $? == 0 ]
then
profile set repositories $IPFS
diff --git a/bin/ak-sm-files b/bin/ak-sm-files
index 9548b3b..56e80d1 100755
--- a/bin/ak-sm-files
+++ b/bin/ak-sm-files
@@ -6,6 +6,7 @@ CRD=$(cat .pwd)
PROGRAM="$(basename $0)"
#set -xe
source $AK_LIBDIR/_ak_logit
+source $AK_LIBDIR/_ak_ipfs
source $AK_LIBDIR/_ak_gpg
if [ ! -d $ZFILESDIR ]; then
@@ -61,7 +62,7 @@ main(){
fi
logit "INFO" "Adding $FILENAME to IPFS..."
- FILE_IPFS_HASH=$(ak-ipfs-add $FILENAME)
+ FILE_IPFS_HASH=$(_ak_ipfs_add $FILENAME)
if [ $? == 0 ]; then
logit "INFO" "Added $FILENAME to IPFS"
else
@@ -86,7 +87,7 @@ main(){
fi
logit