diff options
Diffstat (limited to 'bin/ak-folders')
-rwxr-xr-x | bin/ak-folders | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bin/ak-folders b/bin/ak-folders index 2a28dd9..280af2b 100755 --- a/bin/ak-folders +++ b/bin/ak-folders @@ -5,21 +5,24 @@ ZFOLDERSDIR="$AK_WORKDIR/folders" TEMP="/tmp/aktmp" logit(){ - ak-logthis "<$PROGRAM>" "$1" "$2" + ak-logthis "$PROGRAM" "$1" "$2" } if [ ! -d $ZFOLDERSDIR ]; then mkdir $ZFOLDERSDIR - cd $ZFOLDERSDIR + logit "ERROR" "error $ZFOLDERSDIR not found or/and could not be created" else - logit "[ERROR]" "error $ZFOLDERSDIR not found or/and could not be created" + logit "INFO" "Found $ZFOLDERSDIR" + exit 1 fi TEMPASSIN="$(ak-tempassin)" cd $TEMPASSIN _ak_modules_folders_usage(){ _ak_modules_folders_title - echo "$PROGRAM - folder" + echo "" + echo " -h, --help Show this message" + echo " add <folder> Try ak-folders add <folder>" } _ak_modules_folders_add(){ @@ -33,24 +36,24 @@ _ak_modules_folders_main(){ FOLDERNAME="$1" CRP="$2" echo "Adding $FOLDERNAME" - logit "[INFO]" "Copying $1 to temporary folder" + logit "INFO" "Copying $1 to temporary folder" cp -r $2/$1 $1 if [ $? == 0 ]; then - logit "[INFO]" "Copied successfully" + logit "INFO" "Copied successfully" else - logit "[ERROR]" "Error copying..." + logit "ERROR" "Error copying..." fi FOLDER="$1" - logit "[INFO]" "Adding $FOLDER to IPFS..." + logit "INFO" "Adding $FOLDER to IPFS..." FOLDER_IPFS_HASH=$(ak-ipfs-add $FOLDER) if [ $? == 0 ]; then - logit "[INFO]" "done" + logit "INFO" "done" else - logit "[ERROR]" "error" + logit "ERROR" "error" fi - logit "[WARNING]" "Folders are not signing..." + logit "WARNING" "Folders are not signing..." printf '{"timestamp":"%s","foldername":"%s","ipfs":"%s"}' $(date -u +%s) $FOLDERNAME $FOLDER_IPFS_HASH @@ -69,8 +72,7 @@ _ak_modules_folders_main(){ } _ak_modules_folders_title(){ - echo "$PROGRAM" - echo "Folder block creator" + echo "$PROGRAM - Folder block creator" } |