From 21c7f1852b0d2ca145d18a165d6d90c6127dc44a Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 24 Jun 2024 06:01:16 +0300 Subject: refactoring --- bin/ak-find-latest-mined-sblock | 3 ++- lib/_ak_fm | 4 ++-- lib/_ak_network | 6 +++--- lib/_ak_zblock | 2 +- lib/_ak_zchain | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock index 74fa919..c91197e 100755 --- a/bin/ak-find-latest-mined-sblock +++ b/bin/ak-find-latest-mined-sblock @@ -3,6 +3,7 @@ cd $AK_MINEDBLOCKSDIR PROGRAM="$(basename $0)" declare -A counters source $AK_LIBDIR/_ak_log +source $AK_LIBDIR/_ak_script source $AK_LIBDIR/_ak_ipfs if [ ! -z $1 ] && [ -n "$1" ] @@ -50,7 +51,7 @@ lookfor(){ fi } -templistblock="$(mktemp)" +templistblock="$(_ak_make_temp_file)" find . -type f | sed 's/^\.\/000/000/g' | grep '^000' | sort > $templistblock while IFS="" read -r p || [ -n "$p" ] do diff --git a/lib/_ak_fm b/lib/_ak_fm index cf1a14b..deefb6d 100755 --- a/lib/_ak_fm +++ b/lib/_ak_fm @@ -1,7 +1,7 @@ #!/bin/bash _ak_fm_remove_line_from_file(){ - tempfile="$(mktemp)" + tempfile="$(_ak_make_temp_file)" if [ ! -f "$2" ] then _ak_log_error "$2 does not exist" @@ -23,7 +23,7 @@ _ak_fm_sort_uniq_file(){ _ak_log_info "No file to process" else _ak_log_info "Sorting $1..." - tempfile="$(mktemp)" + tempfile="$(_ak_make_temp_file)" cat "$1" | sort | uniq > $tempfile cat $tempfile > $1 rm $tempfile diff --git a/lib/_ak_network b/lib/_ak_network index 8c40f2b..2cdec02 100755 --- a/lib/_ak_network +++ b/lib/_ak_network @@ -24,7 +24,7 @@ _ak_network_cjdns_scanner(){ exit 1 fi - TEMPDIR="$(mktemp -d)" + TEMPDIR="$(_ak_make_temp_directory)" AK_ZPEERSFILE="$HOME/.arching-kaos/peersFile" cd $TEMPDIR counter=0 @@ -112,7 +112,7 @@ _ak_network_stellar_get_asset_holders(){ } _ak_network_scan_stellar(){ - tempdir=`mktemp -d` + tempdir=`_ak_make_temp_directory` tempfile="$tempdir/tmp" tempaddr="$tempdir/tmpaddr" @@ -265,7 +265,7 @@ _ak_network_cjdns_connect(){ then peersfile="$1" else - peersfile="$(mktemp)" + peersfile="$(_ak_make_temp_file)" tmpon="yes" curl -s "https://arching-kaos.net/files/ak_cjdns_bootstrap_peers" > $peersfile fi diff --git a/lib/_ak_zblock b/lib/_ak_zblock index b9fb91a..28d7c34 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -384,7 +384,7 @@ _ak_zblock_gen_html(){ fi fi - arg="$(mktemp)" + arg="$(_ak_make_temp_file)" _ak_zblock_show "$1" | jq > $arg _ak_generate_html_header > zblock-$1.html diff --git a/lib/_ak_zchain b/lib/_ak_zchain index 87fa5cf..d6925bf 100755 --- a/lib/_ak_zchain +++ b/lib/_ak_zchain @@ -96,7 +96,7 @@ _ak_zchain_extract_data_cids(){ } _ak_zchain_calculate_size(){ - temp="$(mktemp -d)" + temp="$(_ak_make_temp_directory)" cd $temp if [ ! -z $1 ] && [ -n "$1" ] then -- cgit v1.2.3