diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 05:41:52 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 05:41:52 +0300 |
commit | 55626cf414f947be0ce5c8300f97f99421c2e222 (patch) | |
tree | b9d5cdaf482eeacaf3e253b6c806ff0b2272bc06 /lib | |
parent | d14dda9f79215ab44684e0f5a64327a079a6c58f (diff) | |
download | arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.tar.gz arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.tar.bz2 arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.zip |
Reworked tempassin to lib/_ak_script
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/_ak_fs | 4 | ||||
-rwxr-xr-x | lib/_ak_script | 22 |
2 files changed, 24 insertions, 2 deletions
@@ -65,7 +65,7 @@ _ak_fs_import(){ # Merkle tree file/references MERKLEDIR="$AK_WORKDIR/fmrk" # A temporary root dir to work on - TEMPORARYDIR="$(ak-tempassin)" + TEMPORARYDIR="$(_ak_make_temp_directory)" # A subdir to split the files there TECHDIR="$TEMPORARYDIR/chks" # A pin point to return from where we came from @@ -306,7 +306,7 @@ _ak_fs_cat(){ fmrk="$AK_WORKDIR/fmrk" ftr="$AK_WORKDIR/ftr" # Enter temp folder - TEMPASSIN="$(ak-tempassin)" + TEMPASSIN="$(_ak_make_temp_directory)" cd $TEMPASSIN currentNode="$treeRootHash" counter=0 diff --git a/lib/_ak_script b/lib/_ak_script index e9d7c0e..f24fbc9 100755 --- a/lib/_ak_script +++ b/lib/_ak_script @@ -67,3 +67,25 @@ _ak_not_implemented(){ #_ak_title_description _ak_log_error "Not implemented: $*" } + +_ak_make_temp_directory(){ + AK_TEMP="$(mktemp -d /tmp/aktmp-XXXXXXX)" + if [ ! -d "$AK_TEMP" ] + then + _ak_log_error "Could not make $AK_TEMP directory to work in" + exit 1 + fi + _ak_log_info "$AK_TEMP created successfully" + echo "$AK_TEMP" +} + +_ak_make_temp_file(){ + AK_TEMP="$(mktemp /tmp/aktmp-XXXXXXX)" + if [ ! -f "$AK_TEMP" ] + then + _ak_log_error "Could not make $AK_TEMP directory to work in" + exit 1 + fi + _ak_log_info "$AK_TEMP created successfully" + echo "$AK_TEMP" +} |