From b61b49bd34514c9b3b7f5abca054ffb8351c119a Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 2 Jun 2024 04:32:13 +0300 Subject: Zero effect, preample to upcoming changes --- bin/ak | 12 ++++++++++++ bin/ak-miner-script | 12 ++++++++++++ lib/_ak_log | 48 ++++++++++++++++++++---------------------------- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/bin/ak b/bin/ak index bb991a1..c64ee44 100755 --- a/bin/ak +++ b/bin/ak @@ -17,6 +17,7 @@ descriptionString="Arching Kaos CLI" source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_script +source $AK_WORKDIR/rc if [ $# -eq 0 ] then @@ -49,6 +50,17 @@ then fi subcmd="$(echo $* | sed -e 's/ /-/g')" + +# Add functionality for separate modules directory +# case "$1" in +# -m|--module) +# shift +# subcmd="modules/$(echo $* | sed -e 's/ /-/g')" +# ;; +# esac +# +# echo $subcmd + if [ -f "$AK_BINDIR/ak-$subcmd" ] then $(echo ak-$subcmd) diff --git a/bin/ak-miner-script b/bin/ak-miner-script index 002c27d..caa74d1 100755 --- a/bin/ak-miner-script +++ b/bin/ak-miner-script @@ -1,5 +1,17 @@ #!/bin/bash PROGRAM="$(basename $0)" +gather_zblocks(){ + cat $AK_ZBLOCKSFILE | \ + jq | \ + grep -e 'Qm.\{44\}' | \ + sed -e 's/\"zblock\"://g; s/ //g;' | \ + tr -d '\n'| \ + sed -e 's/""/","/g; + s/^/[&/g; s/$/&]/g; + s/^/{"zblocks":&/; + s/$/&,/g' +} + proofofwork(){ TEST="$1" PRE="$2" diff --git a/lib/_ak_log b/lib/_ak_log index 242bb27..d2760e6 100755 --- a/lib/_ak_log +++ b/lib/_ak_log @@ -1,25 +1,5 @@ #!/bin/bash -logit(){ - ak-log-message "$PROGRAM" "$1" "$2" -} - -_ak_log_warning(){ - ak-log-message "$PROGRAM" "WARNING" "$1" -} - -_ak_log_debug(){ - ak-log-message "$PROGRAM" "DEBUG" "$1" -} - -_ak_log_error(){ - ak-log-message "$PROGRAM" "ERROR" "$1" -} - -_ak_log_info(){ - ak-log-message "$PROGRAM" "INFO" "$1" -} - _ak_log_follow(){ tail -f $AK_LOGSFILE | while read -r p || [ -n "$p" ] do @@ -64,17 +44,9 @@ _ak_log_rotate(){ } _ak_log_message(){ - PROGRAM="$(basename $0)" TS="$(date -u +%s)" if [ ! -z $1 ] && [ -n "$1" ] then - if [ "$1" == "-h" ] || [ "$1" == "--help" ] - then - echo "$PROGRAM - Log events" - echo "-h, --help Prints this message" - echo " Logs this message" - exit 0 - fi if [ ! -z "$2" ] && [ -n "$2" ] then if [ ! -z "$3" ] && [ -n "$3" ] @@ -110,3 +82,23 @@ _ak_log_message(){ exit 1 fi } + +logit(){ + ak-log-message "$PROGRAM" "$1" "$2" +} + +_ak_log_warning(){ + ak-log-message "$PROGRAM" "WARNING" "$1" +} + +_ak_log_debug(){ + ak-log-message "$PROGRAM" "DEBUG" "$1" +} + +_ak_log_error(){ + ak-log-message "$PROGRAM" "ERROR" "$1" +} + +_ak_log_info(){ + ak-log-message "$PROGRAM" "INFO" "$1" +} -- cgit v1.2.3