aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ak-data-expand28
-rwxr-xr-xlib/_ak_zblock2
2 files changed, 15 insertions, 15 deletions
diff --git a/bin/ak-data-expand b/bin/ak-data-expand
index be51d18..09b5377 100755
--- a/bin/ak-data-expand
+++ b/bin/ak-data-expand
@@ -9,71 +9,71 @@ then
mkdir $AK_WORKDIR/ipfs
fi
-if [ ! -z "$1" ] && [ ! -z "$2" ]
+if [ ! -z $1 ] && [ ! -z $2 ]
then
echo -n "$1" | grep -e 'Qm.\{44\}' >/dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Invalid hash format for $1"
exit 1
fi
_ak_ipfs_cat $1 > /dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while reading $1"
exit 1
fi
_ak_ipfs_cat $1 | jq -M > /dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while parsing JSON for $1"
exit 1
fi
_ak_ipfs_cat $1 | jq | grep ipfs > /dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_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 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
_ak_ipfs_cat $1 | jq | grep detach > /dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_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 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
echo -n "$2" | grep -e 'Qm.\{44\}' >/dev/null
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Invalid hash format for $2"
exit 1
fi
gpg="$2"
_ak_ipfs_get $gpg > /dev/null 2>&1
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Could not get GPG key: $gpg"
exit 1
fi
_ak_gpg_key_import_from_file $gpg > /dev/null 2>&1
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Could not import GPG key: $gpg"
exit 1
fi
_ak_ipfs_get $DETACH > /dev/null 2>&1
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while getting signature: $DETACH for data: $DATA"
exit 1
@@ -81,14 +81,14 @@ then
mv $DETACH $DATA.asc
_ak_log_info "Block signature downloaded"
_ak_ipfs_get $DATA > /dev/null 2>&1
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while getting data: $DATA"
exit 1
fi
_ak_log_info "Data downloaded: $DATA"
_ak_gpg_verify_signature $DATA.asc $DATA > /dev/null 2>&1
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Error while verifying signature for $DATA"
exit 1
diff --git a/lib/_ak_zblock b/lib/_ak_zblock
index 28d7c34..f853ef7 100755
--- a/lib/_ak_zblock
+++ b/lib/_ak_zblock
@@ -172,7 +172,7 @@ _ak_zblock_show(){
data="$(cat $AK_BLOCKDIR/$block | jq -M -r .data)"
_ak_ipfs_cid_v0_check "$data"
ak-data-expand $data $gpg
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Failed on data signature verification [data: $data, gpg: $gpg, zblock: $zblock]"
exit 1