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