From aec105078d8a1b64ca75bc3b7cb20c1d2dbbd59d Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 5 Oct 2025 22:24:48 +0300 Subject: [ak-fs] --llist flag: Long-like list feature. Prints mod date instead of root hash --- bin/ak-fs | 2 ++ lib/_ak_fs | 17 +++++++++++++++++ lib/_ak_ns | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/bin/ak-fs b/bin/ak-fs index f95a924..a7a0dca 100755 --- a/bin/ak-fs +++ b/bin/ak-fs @@ -27,6 +27,7 @@ ## --get, --export Exports a file from the AKFS system ## --cat Concatenates from given hash ## --list Lists names and roots available +## --llist Lists names available and their dates ## --net-cat-from-map Concatenates from map via the network ## --net-get-from-map Downloads from map via the network ## --cfm Concatenates from map @@ -53,6 +54,7 @@ then --net-cat-from-map) _ak_fs_net_cat_from_map_hash $2; exit;; --net-get-from-map) _ak_fs_net_get_from_map_hash $2; exit;; --list) _ak_fs_list; exit;; + --llist) _ak_fs_long_list; exit;; --cfm) _ak_fs_cat_from_map_hash $2; exit;; --gfm) _ak_fs_get_from_map_hash $2; exit;; --rhd) _ak_fs_return_hash_dir $2; echo ;exit;; diff --git a/lib/_ak_fs b/lib/_ak_fs index 07929b6..108c682 100755 --- a/lib/_ak_fs +++ b/lib/_ak_fs @@ -354,6 +354,23 @@ function _ak_fs_list(){ fi } +function _ak_fs_long_list(){ + if [ -d "${AK_MAPSDIR}" ] + then + find $AK_MAPSDIR -type f | while read fina + do + stats="$(stat --format=%y ${fina}|tr -d '\n'|tr ' ' '_')" + date_stats="$(echo ${stats}|cut -d '_' -f 1)" + time_stats="$(echo ${stats}|cut -d '_' -f 2|cut -d '.' -f 1)" + cat $fina | tr '\n' ' ' | awk '{ print "'$(basename ${fina})' " "'$date_stats'" " " "'$time_stats'" " "$2 }' + done + else + _ak_log_debug "Making ${AK_MAPSDIR} directory" + mkdir -p ${AK_MAPSDIR} + _ak_log_debug "Empty directory" + fi +} + function _ak_fs_from_map_get_original_hash(){ if [ ! -z "$1" ] && [ -n "$1" ] then diff --git a/lib/_ak_ns b/lib/_ak_ns index 24c0761..e6e8e65 100755 --- a/lib/_ak_ns +++ b/lib/_ak_ns @@ -297,6 +297,9 @@ function _ak_ns_resolve_all_keys(){ fi done > peer_list _ak_log_info "Filtering IPs out of locals..." + # cat ip_list + _ak_log_info "Filtering IPs out from peers..." + # cat peer_list cat ip_list | while read ip do sed -i 's/^'$ip'$//g' peer_list @@ -306,12 +309,17 @@ function _ak_ns_resolve_all_keys(){ _ak_log_error "No IPs to scan from" exit 1 fi + _ak_log_info "Filtered IPs out from peers..." + # cat peer_list cat peer_list | while read ip do _ak_log_info "Extracing keys from $ip..." ak network -p incoming \ | jq --arg ip "$ip" '.[] | select(.incoming.ip == $ip )' \ | jq '.node_info.keymaps.[]'> keymaps_list.$ip +# ak network -p incoming \ +# | jq --arg ip "$ip" '.[] | select(.incoming.ip == $ip )' \ +# | jq '.node_info.keymaps.[]' done cat peer_list | while read ip do -- cgit v1.2.3