From 7affa2082f61455a413d0c8fea08e79935d4f308 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 1 Mar 2024 19:20:34 +0200 Subject: Spacing adjustment --- bin/ak-sm-files | 75 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'bin/ak-sm-files') diff --git a/bin/ak-sm-files b/bin/ak-sm-files index 7ee3d42..17635d6 100755 --- a/bin/ak-sm-files +++ b/bin/ak-sm-files @@ -6,28 +6,29 @@ CRD=$(cat .pwd) PROGRAM="$(basename $0)" #set -xe logit(){ - ak-logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "$PROGRAM" "$1" "$2" } if [ ! -d $ZFILESDIR ]; then - mkdir $ZFILESDIR - if [ $? == 0 ] - then - logit "[INFO]" "Folder $ZFILESDIR created!" - else - logit "[ERROR]" "Failed to create $ZFILESDIR folder" - exit 1 - fi - cd $ZFILESDIR + mkdir $ZFILESDIR + if [ $? == 0 ] + then + logit "INFO" "Folder $ZFILESDIR created!" + else + logit "ERROR" "Failed to create $ZFILESDIR folder" + exit 1 + fi + cd $ZFILESDIR else - logit "[INFO]" "$ZFILESDIR found!" + logit "INFO" "$ZFILESDIR found!" fi usage(){ - echo "$PROGRAM - file" - echo " add " - echo " index" - echo " full-index" - echo " ls-map-files" + echo "$PROGRAM - file" + echo " -h, --help Prints this help message" + echo " add Adds file to zchain as a zblock" + echo " index List files" + echo " full-index List all files" + echo " ls-map-files List map files" } add(){ @@ -45,59 +46,59 @@ main(){ echo "Adding $FILENAME" logit "[INFO]" "Switching to tmp folder..." if [ $? == 0 ]; then - logit "[INFO]" "Success" + logit "INFO" "Success" else - logit "[ERROR]" "Error with tmp folder" - exit 5 + logit "ERROR" "Error with tmp folder" + exit 5 fi logit "[INFO]" "Copying $1 to $TEMPASSIN" cp $CRP/$FILENAME $FILENAME if [ $? == 0 ]; then - logit "[INFO]" "Copied successfully" + logit "INFO" "Copied successfully" else - logit "[ERROR]" "Error copying..." + logit "ERROR" "Error copying..." fi logit "[INFO]" "Adding $FILENAME to IPFS..." FILE_IPFS_HASH=$(ak-ipfs-add $FILENAME) if [ $? == 0 ]; then - logit "[INFO]" "Added $FILENAME to IPFS" + logit "INFO" "Added $FILENAME to IPFS" else - logit "[ERROR]" "Error in adding the $FILENAME to IPFS" + logit "ERROR" "Error in adding the $FILENAME to IPFS" fi logit "[INFO]" "Adding $FILE to SHAMAPSYS..." FILEMAP_SHA512_HASH=$(ak-sm-filesplitter $FILENAME) if [ $? == 0 ]; then - logit "[INFO]" "Added $FILENAME to SHAMAPSYS" + logit "INFO" "Added $FILENAME to SHAMAPSYS" else - logit "[ERROR]" "Error in adding the $FILENAME to SHAMAPSYS" + logit "ERROR" "Error in adding the $FILENAME to SHAMAPSYS" fi logit "[INFO]" "Signing..." SIGN_FILE=$FILENAME".asc" gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILENAME if [ $? == 0 ]; then - logit "[INFO]" "Signed" + logit "INFO" "Signed" else - logit "[ERROR]" "Error while signing" + logit "ERROR" "Error while signing" fi logit "[INFO]" "Adding signature to IPFS" SIGNATURE=$(ak-ipfs-add $SIGN_FILE) if [ $? == 0 ]; then - logit "[INFO]" "Added" + logit "INFO" "Added" else - logit "[ERROR]" "Error while adding" + logit "ERROR" "Error while adding" fi logit "[INFO]" "Adding signature to SHAMAPSYS" SHAMAPSIGMAP=$(ak-sm-filesplitter $SIGN_FILE) if [ $? == 0 ]; then - logit "[INFO]" "Added" + logit "INFO" "Added" else - logit "[ERROR]" "Error while adding" + logit "ERROR" "Error while adding" fi cat > data <