aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_ak_checks3
-rwxr-xr-xlib/_ak_cjdns5
-rwxr-xr-xlib/_ak_config3
-rwxr-xr-xlib/_ak_datetime (renamed from lib/_ak_utils)3
-rwxr-xr-xlib/_ak_fm4
-rwxr-xr-xlib/_ak_fs5
-rwxr-xr-xlib/_ak_gpg18
-rwxr-xr-xlib/_ak_hash_exchange6
-rwxr-xr-xlib/_ak_html3
-rwxr-xr-xlib/_ak_ipfs4
-rwxr-xr-xlib/_ak_irc8
-rwxr-xr-xlib/_ak_lib_load32
-rwxr-xr-xlib/_ak_log10
-rwxr-xr-xlib/_ak_maintainance3
-rwxr-xr-xlib/_ak_network13
-rwxr-xr-xlib/_ak_network_cjdns3
-rwxr-xr-xlib/_ak_network_incoming9
-rwxr-xr-xlib/_ak_network_ipfs9
-rwxr-xr-xlib/_ak_network_stellar7
-rwxr-xr-xlib/_ak_network_utils5
-rwxr-xr-xlib/_ak_network_yggdrasil5
-rwxr-xr-xlib/_ak_node4
-rwxr-xr-xlib/_ak_ns202
-rwxr-xr-xlib/_ak_pkg12
-rwxr-xr-xlib/_ak_sblock4
-rwxr-xr-xlib/_ak_script5
-rwxr-xr-xlib/_ak_settings7
-rwxr-xr-xlib/_ak_sh4
-rwxr-xr-xlib/_ak_smfiles3
-rwxr-xr-xlib/_ak_yggdrasil6
-rwxr-xr-xlib/_ak_zblock15
-rwxr-xr-xlib/_ak_zchain11
32 files changed, 353 insertions, 78 deletions
diff --git a/lib/_ak_checks b/lib/_ak_checks
index 90b01ad..97b3d8a 100755
--- a/lib/_ak_checks
+++ b/lib/_ak_checks
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
function _ak_checks_example_check_for_base64_strings(){
diff --git a/lib/_ak_cjdns b/lib/_ak_cjdns
index 76b39db..51832d3 100755
--- a/lib/_ak_cjdns
+++ b/lib/_ak_cjdns
@@ -17,9 +17,10 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_network
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_network
rust_sh_install_url="https://sh.rustup.rs"
cjdns_src_git_repo_url="https://github.com/cjdelisle/cjdns"
cjdnstoolspath="$HOME/cjdns/tools"
diff --git a/lib/_ak_config b/lib/_ak_config
index 25a9563..6c71e9c 100755
--- a/lib/_ak_config
+++ b/lib/_ak_config
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_node
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_node
function _ak_config_show(){
# We will be using our public key also to put it in the block later
diff --git a/lib/_ak_utils b/lib/_ak_datetime
index 571fff4..a25696f 100755
--- a/lib/_ak_utils
+++ b/lib/_ak_datetime
@@ -17,6 +17,7 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
+
function _ak_datetime_unix(){
date -u +%s | tr -d '\n'
}
@@ -43,5 +44,3 @@ function _ak_datetime_unix_to_human(){
date --date=@$1 +%Y%m%d_%H%M%S 2>/dev/null || date -r $1 +%Y%m%d_%H%M%S 2>/dev/null
fi
}
-
-_ak_log_debug "_ak_utils loaded $(caller)"
diff --git a/lib/_ak_fm b/lib/_ak_fm
index d77cac7..5971a88 100755
--- a/lib/_ak_fm
+++ b/lib/_ak_fm
@@ -18,7 +18,9 @@
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
function _ak_fm_remove_line_from_file(){
tempfile="$(_ak_make_temp_file)"
diff --git a/lib/_ak_fs b/lib/_ak_fs
index 9bf7022..a0f5619 100755
--- a/lib/_ak_fs
+++ b/lib/_ak_fs
@@ -18,8 +18,9 @@
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_hash_exchange
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_hash_exchange
function _ak_fs_dir_init_setup(){
_ak_check_and_create_dir $AK_MAPSDIR
diff --git a/lib/_ak_gpg b/lib/_ak_gpg
index edfc1d7..7832ca1 100755
--- a/lib/_ak_gpg
+++ b/lib/_ak_gpg
@@ -17,10 +17,11 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_ipfs
-source $AK_LIBDIR/_ak_config
-source $AK_LIBDIR/_ak_settings
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_ipfs
+_ak_lib_load _ak_config
+_ak_lib_load _ak_settings
export AK_FINGERPRINT="$(_ak_settings_get gpg.fingerprint)"
@@ -133,6 +134,15 @@ function _ak_gpg_sign_clear(){
fi
}
+function _ak_gpg_sign_clear_with_key(){
+ if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ ! -z $3 ] && [ -n "$3" ]
+ then
+ _ak_gpg --clear-sign --sign-with $3 --armor --output $1 $2
+ else
+ exit 1
+ fi
+}
+
function _ak_gpg_encrypt_sign(){
if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ ! -z $3 ] && [ -n "$3" ]
then
diff --git a/lib/_ak_hash_exchange b/lib/_ak_hash_exchange
index e2ce310..3751a8e 100755
--- a/lib/_ak_hash_exchange
+++ b/lib/_ak_hash_exchange
@@ -17,8 +17,10 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_fm
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_fm
+
AK_TREEFS="$AK_WORKDIR/tree"
AK_SESSIONSDIR="$AK_WORKDIR/sessions"
diff --git a/lib/_ak_html b/lib/_ak_html
index c9a898d..281790e 100755
--- a/lib/_ak_html
+++ b/lib/_ak_html
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
function _ak_generate_html_header(){
printf '<!DOCTYPE html>\n<html>\n<head>\n'
diff --git a/lib/_ak_ipfs b/lib/_ak_ipfs
index e30c1e1..07595ae 100755
--- a/lib/_ak_ipfs
+++ b/lib/_ak_ipfs
@@ -17,7 +17,9 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+
AK_IPFS_REPO="$AK_WORKDIR/ipfsrepo"
AK_IPFS_ARTIFACTS="$AK_WORKDIR/ipfs_artifacts"
if [ ! -d $AK_IPFS_ARTIFACTS ]
diff --git a/lib/_ak_irc b/lib/_ak_irc
index 25d3f10..85e8bc7 100755
--- a/lib/_ak_irc
+++ b/lib/_ak_irc
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
-
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
function _ak_irc_connect(){
- _ak_not_implemented "LOL"
+ _ak_not_implemented "${FUNCNAME}"
}
_ak_log_debug "_ak_irc loaded $(caller)"
diff --git a/lib/_ak_lib_load b/lib/_ak_lib_load
new file mode 100755
index 0000000..2790458
--- /dev/null
+++ b/lib/_ak_lib_load
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+
+function _ak_lib_load(){
+ typeset -F | grep $1 2>/dev/null 1>&2 || if [ -f "$AK_LIBDIR/$1" ]
+ then
+ source $AK_LIBDIR/$1
+ elif [ -f "./lib/$1" ]
+ then
+ source ./lib/$1
+ else
+ printf "Error: Could not load $1 lib"
+ fi
+
+}
diff --git a/lib/_ak_log b/lib/_ak_log
index b547c4d..51064e7 100755
--- a/lib/_ak_log
+++ b/lib/_ak_log
@@ -18,7 +18,8 @@
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_utils 2>/dev/null || source ./lib/_ak_utils 2>/dev/null
+source ./lib/_ak_lib_load 2>/dev/null || source $AK_LIBDIR/_ak_lib_load 2>/dev/null
+_ak_lib_load _ak_datetime
export AK_LOGSDIR="$AK_WORKDIR/logs"
export AK_LOGSFILE="$AK_LOGSDIR/log"
@@ -81,6 +82,11 @@ function _ak_log_follow(){
done
}
+function _ak_log_last_line(){
+ p="$(tail -n 1 $AK_LOGSFILE | tr -d '\n')"
+ _ak_log_print_log_line "$p"
+}
+
function _ak_log_grep(){
if [ ! -z $1 ] && [ -n "$1" ]
then
@@ -190,5 +196,5 @@ function _ak_log_info(){
_ak_log_message "$PROGRAM" "INFO" "$*"
}
-_ak_log_debug "_ak_log loaded $(caller)"
+# _ak_log_debug "_ak_log loaded $(caller)"
# vim: set syntax=bash
diff --git a/lib/_ak_maintainance b/lib/_ak_maintainance
index bd7441b..ab8d9da 100755
--- a/lib/_ak_maintainance
+++ b/lib/_ak_maintainance
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
function _ak_maintainance_backup(){
if [ -n "${AK_WORKDIR}" ] && [ -d "${AK_WORKDIR}" ]
diff --git a/lib/_ak_network b/lib/_ak_network
index 442bf90..c6d048e 100755
--- a/lib/_ak_network
+++ b/lib/_ak_network
@@ -17,12 +17,13 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_network_ipfs
-source $AK_LIBDIR/_ak_network_cjdns
-source $AK_LIBDIR/_ak_network_yggdrasil
-source $AK_LIBDIR/_ak_network_stellar
-source $AK_LIBDIR/_ak_network_incoming
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_network_ipfs
+_ak_lib_load _ak_network_cjdns
+_ak_lib_load _ak_network_yggdrasil
+_ak_lib_load _ak_network_stellar
+_ak_lib_load _ak_network_incoming
function _ak_network_scan(){
if [ ! -z $1 ] && [ -n "$1" ]
diff --git a/lib/_ak_network_cjdns b/lib/_ak_network_cjdns
index 9f385f9..9a75690 100755
--- a/lib/_ak_network_cjdns
+++ b/lib/_ak_network_cjdns
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
cjdnstoolspath="$HOME/cjdns/tools"
diff --git a/lib/_ak_network_incoming b/lib/_ak_network_incoming
index 39eb67f..12384a3 100755
--- a/lib/_ak_network_incoming
+++ b/lib/_ak_network_incoming
@@ -17,10 +17,11 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_utils
-source $AK_LIBDIR/_ak_network_utils
-source $AK_LIBDIR/_ak_fm
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_datetime
+_ak_lib_load _ak_network_utils
+_ak_lib_load _ak_fm
export AK_ZPEERSINCOMING=$AK_ZPEERSDIR/incomingRequests
diff --git a/lib/_ak_network_ipfs b/lib/_ak_network_ipfs
index f666586..172794f 100755
--- a/lib/_ak_network_ipfs
+++ b/lib/_ak_network_ipfs
@@ -17,15 +17,16 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_ipfs
function _ak_network_ipfs_scan(){
- _ak_not_implemented _ak_network_ipfs_scan
+ _ak_not_implemented ${FUNCNAME}
}
function _ak_network_ipfs_show_peers(){
- _ak_not_implemented _ak_network_ipfs_show_peers
+ _ak_not_implemented ${FUNCNAME}
}
function _ak_network_ipfs_connect_bootstrap(){
diff --git a/lib/_ak_network_stellar b/lib/_ak_network_stellar
index cca8ff0..d4fffcf 100755
--- a/lib/_ak_network_stellar
+++ b/lib/_ak_network_stellar
@@ -17,9 +17,10 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_ipfs
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
stellarPeersDir="$AK_ZPEERSDIR/stellar"
_ak_check_and_create_dir $stellarPeersDir
diff --git a/lib/_ak_network_utils b/lib/_ak_network_utils
index 9f4b8ef..d3689fe 100755
--- a/lib/_ak_network_utils
+++ b/lib/_ak_network_utils
@@ -17,8 +17,9 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_utils
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_datetime
##
# Copied from http://y.yggdrasil-network.ca/yia/crawler/crawler-yia.sh made by
diff --git a/lib/_ak_network_yggdrasil b/lib/_ak_network_yggdrasil
index 6e3b796..afabe70 100755
--- a/lib/_ak_network_yggdrasil
+++ b/lib/_ak_network_yggdrasil
@@ -17,8 +17,9 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_utils
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_datetime
function _ak_network_yggdrasil_scan_full(){
# This scan is using HIA resources to scan the whole cjdns network for peers
diff --git a/lib/_ak_node b/lib/_ak_node
index 71dec12..5ca8521 100755
--- a/lib/_ak_node
+++ b/lib/_ak_node
@@ -17,7 +17,9 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_ipfs
# Resolves the IPNS key "ak-config" to its current IPFS value
# Return IPFS CIDv0 without /ipfs/ prefix
diff --git a/lib/_ak_ns b/lib/_ak_ns
new file mode 100755
index 0000000..683f572
--- /dev/null
+++ b/lib/_ak_ns
@@ -0,0 +1,202 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zchain
+
+AK_NS_DIR="${AK_WORKDIR}/akns"
+
+_ak_check_and_create_dir ${AK_NS_DIR}
+
+function _ak_ns_create(){
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No key name was given"
+ exit 1
+ fi
+ if [ "$(echo -n $1| tr -d '[:alnum:]')" != "" ]
+ then
+ _ak_log_error "Name $1 is not allowed. Use only letters and numbers"
+ exit 1
+ fi
+ keyname="$1@keynames.kaos.kaos"
+ _ak_log_info "Checking for ${keyname}..."
+ _ak_gpg_list_secret_keys_long | grep ${keyname} > /dev/null 2>&1
+ if [ $? -ne 0 ]
+ then
+ _ak_log_info "Creating ${keyname}"
+ _ak_gpg_create_key ${keyname}
+ else
+ _ak_log_error "Name ${keyname} already exists"
+ exit 1
+ fi
+}
+
+function _ak_ns_list(){
+ _ak_gpg_list_secret_keys_long | grep '@keynames.kaos.kaos' | cut -d ' ' -f 2
+}
+
+function _ak_ns_list_long(){
+ _ak_gpg_list_secret_keys_long | grep '@keynames.kaos.kaos'
+}
+
+function _ak_ns_resolve_from_key(){
+ # $1; exit;;
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No key was given"
+ exit 1
+ fi
+ key="$1"
+ _ak_log_info "${key} was given"
+ if [ ! -f ${AK_NS_DIR}/${key} ]
+ then
+ _ak_log_error "${key} was not found"
+ exit 1
+ fi
+ _ak_gpg_verify_clear_signature ${AK_NS_DIR}/${key}
+}
+
+function _ak_ns_resolve_from_name(){
+ # $1; exit;;
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No name was given"
+ exit 1
+ fi
+ key_name="$1"
+ _ak_log_info "${key_name} was given"
+ if [ "${key_name}" == "zchain" ] || [ "${key_name}" == "zconfig" ]
+ then
+ _ak_log_info "${key_name} search on local secret keychain"
+ key="$(_ak_gpg_list_secret_keys_long | grep ${key_name}'@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ if [ ! -n "${key}" ]
+ then
+ _ak_log_error "${key_name} was not found locally"
+ exit 1
+ fi
+ _ak_ns_resolve_from_key ${key}
+ fi
+}
+
+function _ak_ns_publish(){
+ # $1 $2; exit;;
+ _ak_not_implemented "${FUNCNAME}"
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No key was given"
+ exit 1
+ fi
+ if [ ! -z $2 ] || [ ! -n "$2" ]
+ then
+ _ak_log_error "No value was given"
+ exit 1
+ fi
+ if [ "$(echo -n $1| sed -e 's/[A-F0-9]\{40\}//')" != "" ]
+ then
+ _ak_log_error "$1 is not a valid key"
+ exit 1
+ fi
+ if [ "$(echo -n $2| sed -e 's/[a-f0-9]\{128\}//')" != "" ]
+ then
+ _ak_log_error "$2 is not a valid hash"
+ exit 1
+ fi
+ key="$(_ak_gpg_list_secret_keys | grep $1)"
+ value="$2"
+ if [ ! -n "${key}" ]
+ then
+ _ak_log_error "Key $1 was not found"
+ exit 1
+ fi
+ _ak_log_info "Key $1 was found"
+ if [ ! -z $2 ] || [ -n "$2" ]
+ then
+ _ak_gpg_sign_clear_with_key $key
+ fi
+}
+
+function _ak_ns_publish2name(){
+ # $1 $2; exit;;
+ _ak_not_implemented "${FUNCNAME}"
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No key name was given"
+ exit 1
+ fi
+ if [ "$(echo -n $1| tr -d '[:alnum:]')" != "" ]
+ then
+ _ak_log_error "Name $1 is not allowed. Use only letters and numbers"
+ exit 1
+ fi
+ key="$(_ak_gpg_list_secret_keys_long | grep $1'@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ if [ ! -n "${key}" ]
+ then
+ _ak_log_error "No key found with name $1"
+ exit 1
+ fi
+ _ak_ns_publish ${key} $2
+}
+
+function _ak_ns_publish_zchain(){
+ zlatest="$(_ak_zchain_get_latest)"
+ zchain_key="$(_ak_gpg_list_secret_keys_long | grep 'zchain@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ if [ ! -n "${zchain_key}" ]
+ then
+ _ak_log_warning "zchain_key not there"
+ _ak_log_info "Creating zchain_key"
+ _ak_ns_create zchain
+ fi
+ zchain_key="$(_ak_gpg_list_secret_keys_long | grep 'zchain@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ zlatest_file="$(_ak_make_temp_file)"
+ echo -n ${zlatest} > ${zlatest_file}
+ zlatest_csigned_file="$(_ak_make_temp_file)"
+ _ak_gpg_sign_clear_with_key ${zlatest_csigned_file} ${zlatest_file} ${zchain_key}
+ if [ -f ${AK_NS_DIR}/${zchain_key} ]
+ then
+ _ak_gpg_verify_clear_signature ${AK_NS_DIR}/${zchain_key} >> ${AK_NS_DIR}/${zchain_key}.history
+ fi
+ mv ${zlatest_csigned_file} ${AK_NS_DIR}/${zchain_key}
+}
+
+function _ak_ns_publish_config(){
+ zconfig="$(_ak_node_info_ipfs_hash)"
+ zconfig_key="$(_ak_gpg_list_secret_keys_long | grep 'zconfig@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ if [ ! -n "${zconfig_key}" ]
+ then
+ _ak_log_warning "zconfig_key not there"
+ _ak_log_info "Creating zconfig_key"
+ _ak_ns_create zconfig
+ fi
+ zconfig_key="$(_ak_gpg_list_secret_keys_long | grep 'zconfig@keynames.kaos.kaos' | cut -d ' ' -f 1)"
+ zconfig_file="$(_ak_make_temp_file)"
+ echo -n ${zconfig} > ${zconfig_file}
+ zconfig_csigned_file="$(_ak_make_temp_file)"
+ _ak_gpg_sign_clear_with_key ${zconfig_csigned_file} ${zconfig_file} ${zconfig_key}
+ if [ -f ${AK_NS_DIR}/${zconfig_key} ]
+ then
+ _ak_gpg_verify_clear_signature ${AK_NS_DIR}/${zconfig_key} >> ${AK_NS_DIR}/${zconfig_key}.history
+ fi
+ mv ${zconfig_csigned_file} ${AK_NS_DIR}/${zconfig_key}
+}
+
+_ak_log_debug "_ak_ns loaded $(caller)"
diff --git a/lib/_ak_pkg b/lib/_ak_pkg
index b3f99e0..e430a50 100755
--- a/lib/_ak_pkg
+++ b/lib/_ak_pkg
@@ -17,12 +17,12 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_fs
-source $AK_LIBDIR/_ak_gpg
-source $AK_LIBDIR/_ak_zblock
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_fs
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zblock
function _ak_pkg_all_modules_make_release_from_local_installation(){
outdir="$(pwd)"
diff --git a/lib/_ak_sblock b/lib/_ak_sblock
index 374ac11..ff39288 100755
--- a/lib/_ak_sblock
+++ b/lib/_ak_sblock
@@ -17,8 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
function _ak_sblock_show(){
if [ ! -z $1 ]
diff --git a/lib/_ak_script b/lib/_ak_script
index 1be8710..02741cb 100755
--- a/lib/_ak_script
+++ b/lib/_ak_script
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source ./lib/_ak_log > /dev/null 2>&1 || source $AK_LIBDIR/_ak_log > /dev/null 2>&1
+source ./lib/_ak_lib_load > /dev/null 2>&1 || source $AK_LIBDIR/_ak_lib_load > /dev/null 2>&1
+_ak_lib_load _ak_log
# Wanna talk about it?
function _ak_new_line(){
@@ -219,4 +220,4 @@ function _ak_countdown_seconds(){
printf "\n"
}
-_ak_log_debug "_ak_script loaded $(caller)"
+# _ak_log_debug "_ak_script loaded $(caller)"
diff --git a/lib/_ak_settings b/lib/_ak_settings
index ce36d10..3345e49 100755
--- a/lib/_ak_settings
+++ b/lib/_ak_settings
@@ -18,7 +18,8 @@
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_script
if [ ! -d "${AK_WORKDIR}" ]
then
@@ -135,11 +136,11 @@ function _ak_settings_set(){
}
function _ak_settings_get_sub(){
- _ak_not_implemented
+ _ak_not_implemented ${FUNCNAME}
}
function _ak_settings_get_all(){
- _ak_not_implemented
+ _ak_not_implemented ${FUNCNAME}
}
_ak_log_debug "_ak_settings loaded $(caller)"
diff --git a/lib/_ak_sh b/lib/_ak_sh
index 723f238..d7ab393 100755
--- a/lib/_ak_sh
+++ b/lib/_ak_sh
@@ -17,8 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
function _ak_shell_help(){
_ak_log_info "# AK shell commands:"
diff --git a/lib/_ak_smfiles b/lib/_ak_smfiles
index c90a90a..91e075e 100755
--- a/lib/_ak_smfiles
+++ b/lib/_ak_smfiles
@@ -17,7 +17,8 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
# The directory where the chunked data will be living at
CHKDIR="$AK_WORKDIR/ftr"
diff --git a/lib/_ak_yggdrasil b/lib/_ak_yggdrasil
index a4a2c6f..855dff8 100755
--- a/lib/_ak_yggdrasil
+++ b/lib/_ak_yggdrasil
@@ -17,9 +17,9 @@
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
-
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_network
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_network
golang_src_git_repo_url="https://github.com/golang/go"
yggdrasil_src_git_repo_url="https://github.com/yggdrasil-network/yggdrasil-go"
diff --git a/lib/_ak_zblock b/lib/_ak_zblock
index 8d22316..c5e58d9 100755
--- a/lib/_ak_zblock
+++ b/lib/_ak_zblock
@@ -18,13 +18,14 @@