diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ak-enter | 2 | ||||
-rwxr-xr-x | bin/ak-profile | 2 | ||||
-rwxr-xr-x | bin/ak-sm-files | 2 | ||||
-rwxr-xr-x | bin/ak-tempassin | 35 | ||||
-rwxr-xr-x | bin/ak-zchain-chk | 2 |
5 files changed, 31 insertions, 12 deletions
diff --git a/bin/ak-enter b/bin/ak-enter index 59bb943..e5b8fbc 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -98,7 +98,7 @@ seed="$(cat $AK_ZGENESIS)" zblock="$entrance" # Enter temp folder -TEMPASSIN="$(ak-tempassin)" +TEMPASSIN="$(_ak_make_temp_directory)" cd $TEMPASSIN counter=0 diff --git a/bin/ak-profile b/bin/ak-profile index 1712575..c686f28 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -178,7 +178,7 @@ _ak_modules_profile_import(){ # Adds a file as a profile/add ACTION on the zchain. _ak_modules_profile_add(){ - TEMP="$(ak-tempassin)" + TEMP="$(_ak_make_temp_directory)" cd $TEMP if [ -f $ZPROFILEDIR/$1 ]; then FILE="$ZPROFILEDIR/$1" diff --git a/bin/ak-sm-files b/bin/ak-sm-files index d0514f8..1d69f08 100755 --- a/bin/ak-sm-files +++ b/bin/ak-sm-files @@ -42,7 +42,7 @@ main(){ FILENAME="$1" CRP="$2" - TEMPASSIN="$(ak-tempassin)" + TEMPASSIN="$(_ak_make_temp_directory)" cd $TEMPASSIN echo "Adding $FILENAME" diff --git a/bin/ak-tempassin b/bin/ak-tempassin index 6831dc2..42042f7 100755 --- a/bin/ak-tempassin +++ b/bin/ak-tempassin @@ -1,14 +1,33 @@ #!/bin/bash -AK_TEMP="$(mktemp -d /tmp/aktmp-XXXXXXX)" -PROGRAM="$(basename $0)" +## +## ak-tempassin: a `mktemp` interface +## +## Usage: +## +## -h, --help Prints this help message +## +## -f, --file Creates a temporary file and output fullpath +## +## -d, --dir Makes a temporary directory and returns its +## fullpath +## +fullprogrampath="$(realpath $0)" +PROGRAM=$(basename $0) +descriptionString="Temp file/dir creator" + +# At least these source $AK_LIBDIR/_ak_log +source $AK_LIBDIR/_ak_script -if [ ! -d "$AK_TEMP" ] +# Flags to run +if [ ! -z $1 ] then - _ak_log_error "Could not make $AK_TEMP directory to work in" - echo "Could not make $AK_TEMP directory to work in" - exit 1 + case $1 in + -h | --help) _ak_usage; exit;; + -d | --dir) _ak_make_temp_directory; exit;; + -f | --file) _ak_make_temp_file; exit;; + * ) _ak_usage;; + esac +else _ak_usage fi -_ak_log_info "$AK_TEMP created successfully" -echo "$AK_TEMP" diff --git a/bin/ak-zchain-chk b/bin/ak-zchain-chk index 89a834f..1d9a2f7 100755 --- a/bin/ak-zchain-chk +++ b/bin/ak-zchain-chk @@ -50,7 +50,7 @@ zblock="$entrance" declare -A blocks_found # Enter temp folder -TEMPASSIN="$(ak-tempassin)" +TEMPASSIN="$(_ak_make_temp_directory)" cd $TEMPASSIN counter=0 |