From 30a2bc6cc950bcd460e5a3651ab869a732a0f50b Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 30 Jun 2024 07:01:15 +0300 Subject: Refactoring --- lib/_ak_fs | 2 +- lib/_ak_ipfs | 2 +- lib/_ak_network | 2 +- lib/_ak_zblock | 16 ++++++++-------- lib/_ak_zchain | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/_ak_fs b/lib/_ak_fs index da09f93..ac466b4 100755 --- a/lib/_ak_fs +++ b/lib/_ak_fs @@ -282,7 +282,7 @@ _ak_fs_find_depth(){ exit 111 # Try to download stuff # wget -s $remoteMrk/$currentNode -O $fmrk/$currentNode - # if [ "$?" -ne 0 ] + # if [ $? -ne 0 ] # then # exit 111 # fi diff --git a/lib/_ak_ipfs b/lib/_ak_ipfs index f7c2dac..3437083 100755 --- a/lib/_ak_ipfs +++ b/lib/_ak_ipfs @@ -407,7 +407,7 @@ _ak_ipfs_cid_v0_check () { exit 1 fi echo $1 | grep -e 'Qm.\{44\}' > /dev/null - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "$1 is not an IPFS CIDv0 string" exit 1 diff --git a/lib/_ak_network b/lib/_ak_network index aa8105e5..1d77eef 100755 --- a/lib/_ak_network +++ b/lib/_ak_network @@ -100,7 +100,7 @@ _ak_network_scan_stellar(){ test="$(curl \ --connect-timeout 3 \ https://horizon.stellar.org/accounts/$p/data/config 2>/dev/null | grep value)" - if [ "$?" == 0 ] + if [ $? -eq 0 ] then addressValuePair="$(printf '%s %s\n' "$p" "$(echo $test | sed -e 's/^.*: "//g; s/"//g' | base64 -d)")" while IFS="" read -r x || [ -n "$x" ] diff --git a/lib/_ak_zblock b/lib/_ak_zblock index f853ef7..f379870 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -44,7 +44,7 @@ _ak_zblock_show(){ # We check if any $zblock at all _ak_ipfs_cat $zblock | jq -c -M > $AK_ZBLOCKDIR/$zblock - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "ZBLOCK $zblock READ failed" exit 1 @@ -90,14 +90,14 @@ _ak_zblock_show(){ echo -n '"block":"'$block'",' _ak_ipfs_cat $block | jq -c -M > $AK_BLOCKDIR/$block cat $AK_BLOCKDIR/$block | jq -M > /dev/null 2>&1 - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_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 ] + if [ $? -ne 0 ] then _ak_log_error "BLOCK $block is NOT a valid block" exit 1 @@ -132,19 +132,19 @@ _ak_zblock_show(){ if [ $verify == 1 ] then _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 $block_signature > /dev/null 2>&1 - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "Error while getting $block_signature for $block" exit 1 @@ -153,7 +153,7 @@ _ak_zblock_show(){ _ak_log_info "Block signature downloaded" _ak_ipfs_get $block > /dev/null 2>&1 - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "Could not get $block block" exit 1 @@ -161,7 +161,7 @@ _ak_zblock_show(){ _ak_log_info "Downloaded block $block." _ak_gpg_verify_signature $block.asc $block > /dev/null 2>&1 - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "Could not verify $block with GPG key $gpg." exit 1 diff --git a/lib/_ak_zchain b/lib/_ak_zchain index d6925bf..d15048a 100755 --- a/lib/_ak_zchain +++ b/lib/_ak_zchain @@ -29,7 +29,7 @@ _ak_zchain_reset(){ if [ $? != 0 ]; then exit 1; fi ak-config --publish - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "Could not publish new configuration" exit 1 @@ -68,7 +68,7 @@ _ak_zchain_rebase(){ if [ $? != 0 ]; then exit 1; fi ak-config --publish - if [ "$?" -ne 0 ] + if [ $? -ne 0 ] then _ak_log_error "Could not publish new configuration" exit 1 -- cgit v1.2.3