aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-data-expand
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-data-expand')
-rwxr-xr-xbin/ak-data-expand21
1 files changed, 11 insertions, 10 deletions
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"