aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak14
-rwxr-xr-xbin/ak-cjdns7
-rwxr-xr-xbin/ak-clean5
-rwxr-xr-xbin/ak-coin7
-rwxr-xr-xbin/ak-config7
-rwxr-xr-xbin/ak-fs20
-rwxr-xr-xbin/ak-get-balances33
-rwxr-xr-xbin/ak-gpg11
-rwxr-xr-xbin/ak-ipfs (renamed from bin/ak-ipfs-daemon)9
-rwxr-xr-xbin/ak-ipfs-starter5
-rwxr-xr-xbin/ak-irc52
-rwxr-xr-xbin/ak-log6
-rwxr-xr-xbin/ak-maintainance53
-rwxr-xr-xbin/ak-mempool12
-rwxr-xr-xbin/ak-mine8
-rwxr-xr-xbin/ak-network15
-rwxr-xr-xbin/ak-node-info7
-rwxr-xr-xbin/ak-ns61
-rwxr-xr-xbin/ak-pkg59
-rwxr-xr-xbin/ak-profile28
-rwxr-xr-xbin/ak-sblock7
-rwxr-xr-xbin/ak-schain7
-rwxr-xr-xbin/ak-settings7
-rwxr-xr-xbin/ak-sh7
-rwxr-xr-xbin/ak-startup11
-rwxr-xr-xbin/ak-template5
-rwxr-xr-xbin/ak-transactions40
-rwxr-xr-xbin/ak-wallet48
-rwxr-xr-xbin/ak-yggdrasil55
-rwxr-xr-xbin/ak-zblock7
-rwxr-xr-xbin/ak-zchain10
31 files changed, 510 insertions, 113 deletions
diff --git a/bin/ak b/bin/ak
index 8f6305f..5724ce2 100755
--- a/bin/ak
+++ b/bin/ak
@@ -30,9 +30,13 @@ export AK_DEBUG="yes"
##
## -h, --help Prints this help message
##
+## -s, --shell Starts an interactive shell
+##
## -m, --module [module] Run a specified module. If no module provided
## the list of available modules will be printed.
##
+## -f, --function [function] Get the list of available functions
+##
## [command] [args] Run a command. If none provided a list of
## commands will be printed.
##
@@ -41,8 +45,9 @@ PROGRAM="$(basename $0)"
descriptionString="Arching Kaos CLI"
source $HOME/.arching-kaos/rc
-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
if [ $# -eq 0 ]
then
@@ -148,6 +153,10 @@ case "$1" in
$subcmd/main.sh $subargs
_ak_exit_program $? "$subcmd module finished";
;;
+ -s|--shell)
+ rlwrap ak sh -s
+ _ak_exit_program $? "Shell terminated";
+ ;;
esac
if [ -f "$AK_BINDIR/ak-$subcmd" ]
@@ -170,6 +179,7 @@ else
fi
counter=$(($counter + 1))
done
+ _ak_usage
find $AK_BINDIR | while read available
do
echo $(basename $available) |\
diff --git a/bin/ak-cjdns b/bin/ak-cjdns
index d61a477..1b2e4c0 100755
--- a/bin/ak-cjdns
+++ b/bin/ak-cjdns
@@ -33,9 +33,10 @@ PROGRAM=$(basename $0)
descriptionString="cjdns helper"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_cjdns
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_cjdns
# Flags to run
if [ ! -z $1 ]
diff --git a/bin/ak-clean b/bin/ak-clean
index 8e55515..b77e74b 100755
--- a/bin/ak-clean
+++ b/bin/ak-clean
@@ -35,9 +35,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Cleans ak temp files"
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_script
-_ak_tmp_cleanup(){
+function _ak_tmp_cleanup(){
ls -1 /tmp/aktmp* > /dev/null 2>&1
if [ $? -ne 0 ]
then
diff --git a/bin/ak-coin b/bin/ak-coin
index 0bd7f15..c7478ab 100755
--- a/bin/ak-coin
+++ b/bin/ak-coin
@@ -30,9 +30,10 @@ PROGRAM=$(basename $0)
descriptionString="Coin status"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_coin
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_coin
# Flags to run
if [ ! -z $1 ]
diff --git a/bin/ak-config b/bin/ak-config
index 4337a2d..770255b 100755
--- a/bin/ak-config
+++ b/bin/ak-config
@@ -30,9 +30,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Arching Kaos Configuration Tool"
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_config
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_script
+_ak_lib_load _ak_config
+_ak_lib_load _ak_ipfs
if [ ! -z $1 ] && [ -n "$1" ]
then
diff --git a/bin/ak-fs b/bin/ak-fs
index 800a9bb..1109539 100755
--- a/bin/ak-fs
+++ b/bin/ak-fs
@@ -24,20 +24,22 @@
##
## -h, --help Prints this help message
## --add, --import <file> Adds/Imports a file to the AKFS system
-## --get, --export <hash> <output file> Exports a file from the AKFS system
-## --cat <hash> Concatenates from given hash
+## --get, --export <roothash> <output file> Exports a file from the AKFS system
+## --cat <roothash> Concatenates from given hash
## --list Lists names and roots available
-## --net-cat-from-map Concatenates from map via the network
-## --cfm <hash map> Concatenates from map
-## --gfm <hash map> Get file from map
+## --net-cat-from-map <maphash> Concatenates from map via the network
+## --net-get-from-map <maphash> Downloads from map via the network
+## --cfm <maphash> Concatenates from map
+## --gfm <maphash> Get file from map
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="AKFS tools"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_fs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_fs
if [ ! -z $1 ]
then
@@ -53,6 +55,8 @@ then
--list) _ak_fs_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;;
+ --rhp) _ak_fs_return_hash_path $2; echo ; exit;;
* ) _ak_usage;;
esac
else
diff --git a/bin/ak-get-balances b/bin/ak-get-balances
index 5b13999..f5f57ca 100755
--- a/bin/ak-get-balances
+++ b/bin/ak-get-balances
@@ -28,14 +28,15 @@
fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Export balances from schain and zchains"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
-source $AK_LIBDIR/_ak_gpg
-source $AK_LIBDIR/_ak_zchain
-source $AK_LIBDIR/_ak_schain
-source $AK_LIBDIR/_ak_sblock
-source $AK_LIBDIR/_ak_coin
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zchain
+_ak_lib_load _ak_schain
+_ak_lib_load _ak_sblock
+_ak_lib_load _ak_coin
#set -xe
AK_DB="$AK_WORKDIR/db"
@@ -73,7 +74,7 @@ fi
TEMP="$(_ak_make_temp_directory)"
cd $TEMP
-_ak_get_zblocks_from_sblock(){
+function _ak_get_zblocks_from_sblock(){
if [ "$(_ak_sblock_show $1 | jq 'has("zblocks")')" == "true" ]
then
mkdir $1 && cd $1
@@ -85,7 +86,7 @@ _ak_get_zblocks_from_sblock(){
fi
}
-_ak_verify_zblocks_found(){
+function _ak_verify_zblocks_found(){
if [ -d $1 ]
then
cd $1
@@ -119,7 +120,7 @@ _ak_verify_zblocks_found(){
fi
}
-_ak_balances_from_sblock(){
+function _ak_balances_from_sblock(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided $1"
@@ -155,7 +156,7 @@ _ak_balances_from_sblock(){
fi
}
-_ak_rewards_from_sblock(){
+function _ak_rewards_from_sblock(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -191,7 +192,7 @@ _ak_rewards_from_sblock(){
fi
}
-_ak_sblock_get_previous(){
+function _ak_sblock_get_previous(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided !!"
@@ -207,7 +208,7 @@ _ak_sblock_get_previous(){
echo -n $PREVIOUS
}
-_ak_balances_calculate(){
+function _ak_balances_calculate(){
if [ ! -z $1 ] && [ -n "$1" ]
then
_ak_log_info "Calculating balance for $1"
@@ -237,7 +238,7 @@ _ak_balances_calculate(){
fi
}
-_ak_balances_print(){
+function _ak_balances_print(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -255,7 +256,7 @@ _ak_balances_print(){
fi
}
-_ak_schain_counting_balances(){
+function _ak_schain_counting_balances(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
diff --git a/bin/ak-gpg b/bin/ak-gpg
index e3169ca..3acfc0b 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -44,15 +44,17 @@
## -d, --delete-key Delete GPG keys from your keyring
## -ds, --delete-secret-key <fingerprint>
## Delete GPG keys from your keyring
+## -r, --run Runs a command with gpg2
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="GPG cli tool"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_gpg
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_gpg
@@ -63,7 +65,7 @@ if [ ! -z $1 ]; then
--example) example; exit;;
--get-key-self-as-ipfs) _ak_gpg_key_self_get_fingerprint_from_config; exit;;
--get-key-self-as-fingerprint) _ak_gpg_key_self_get_fingerprint; exit;;
- --get-key-fingerprint-from-ipfs) _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
+ --get-key-fingerprint-from-ipfs) shift; _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
--verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
@@ -77,6 +79,7 @@ if [ ! -z $1 ]; then
--select-key | -s) _ak_gpg_select_key; exit;;
--delete-key | -d) _ak_gpg_delete_key; exit;;
--delete-secret-key | -ds) shift; _ak_gpg_delete_secret_key $1; exit;;
+ --run | -r) shift; _ak_gpg $*; exit;;
* ) _ak_usage;;
esac
else _ak_usage
diff --git a/bin/ak-ipfs-daemon b/bin/ak-ipfs
index e9a9bca..f3ef6da 100755
--- a/bin/ak-ipfs-daemon
+++ b/bin/ak-ipfs
@@ -24,14 +24,16 @@
##
## -h, --help Prints this help message
## -d, --daemon Starts IPFS daemon for AK
+## -r, --run Runs an IPFS command for AK
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="IPFS handler"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
# Flags to run
if [ ! -z $1 ]
@@ -39,6 +41,7 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
-d | --daemon) _ak_ipfs_starter; exit;;
+ -r | --run) shift; _ak_ipfs_runner $*; exit;;
* ) _ak_usage;;
esac
else _ak_usage
diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter
index 8076427..df2791c 100755
--- a/bin/ak-ipfs-starter
+++ b/bin/ak-ipfs-starter
@@ -19,8 +19,9 @@
###
PROGRAM="$(basename $0)"
-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
screen -dmS akipfsd _ak_ipfs_daemon
if [ $? -ne 0 ]
diff --git a/bin/ak-irc b/bin/ak-irc
new file mode 100755
index 0000000..b2351ce
--- /dev/null
+++ b/bin/ak-irc
@@ -0,0 +1,52 @@
+#!/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/>.
+###
+##
+## Brief description
+##
+## Usage:
+##
+## -h, --help Prints this help message
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="IRC"
+
+# At least these
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_irc
+
+# Your stuff here...
+example(){
+ echo "Example"
+}
+
+# Flags to run
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ --example) example; exit;;
+ --connect) _ak_irc_connect; exit;;
+ * ) _ak_usage;;
+ esac
+else _ak_usage
+fi
diff --git a/bin/ak-log b/bin/ak-log
index 543d8ee..f1c1391 100755
--- a/bin/ak-log
+++ b/bin/ak-log
@@ -35,8 +35,9 @@ PROGRAM=$(basename $0)
descriptionString="Log file handler"
# At least these
-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
# Your stuff here...
example(){
@@ -48,6 +49,7 @@ if [ ! -z $1 ]; then
case $1 in
-h | --help) _ak_usage; exit;;
-f | --follow) _ak_log_follow; exit;;
+ -l | --last) _ak_log_last_line; exit;;
-g | --grep) _ak_log_grep; exit;;
-m | --message) shift; _ak_log_message $*; exit;;
-r | --rotate) _ak_log_rotate; exit;;
diff --git a/bin/ak-maintainance b/bin/ak-maintainance
new file mode 100755
index 0000000..e0cd82d
--- /dev/null
+++ b/bin/ak-maintainance
@@ -0,0 +1,53 @@
+#!/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/>.
+###
+##
+## Maintainance tool for Arching Kaos. You can backup and restore your
+## installation with this tool.
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## -b, --backup Backs up to a file
+## -r, --restore <filename> Restores from a file
+## -n, --nuke Nuke all but core
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="AK Backup"
+
+# At least these
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_maintainance
+
+# Flags to run
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ -r | --restore) _ak_maintainance_restore $2; exit;;
+ -b | --backup) _ak_maintainance_backup; exit;;
+ -n | --nuke) _ak_maintainance_nuke_all_but_core; exit;;
+ * ) _ak_usage;;
+ esac
+else _ak_usage
+fi
+
diff --git a/bin/ak-mempool b/bin/ak-mempool
index d411ca2..3bd9ca5 100755
--- a/bin/ak-mempool
+++ b/bin/ak-mempool
@@ -29,8 +29,9 @@ PROGRAM=$(basename $0)
descriptionString="Quick description"
# At least these
-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
# Assumptions:
# I suppose each ak node is connected to some IP.
# They also run IPFS.
@@ -45,7 +46,12 @@ while IFS="" read -r p || [ -n "$p" ]
do
peer="$(echo "$p" | sed -e 's/^.*\///')"
_ak_log_info "Peer $peer found! Examining..."
- _ak_ipfs_cat /ipns/$peer/zlatest
+ resolved_peer_ns="$(_ak_ipns_resolve /ipns/${peer})"
+ if [ -n "${resolved_peer_ns}" ]
+ then
+ _ak_log_info "Resolved peer: ${resolved_peer_ns}"
+ _ak_ipfs_cat $resolved_peer_ns/zlatest
+ fi
done < tmp_peers
rm tmp_peers
diff --git a/bin/ak-mine b/bin/ak-mine
index 46e106d..72f90a3 100755
--- a/bin/ak-mine
+++ b/bin/ak-mine
@@ -29,8 +29,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Sblock mining"
-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
+_ak_lib_load _ak_datetime
gather_zblocks(){
if [ "$(cat $AK_ZBLOCKSFILE | jq -r '.[].zblock' | wc -l)" -ne 0 ]
@@ -56,7 +58,7 @@ proofofwork(){
i=1
l=1; while [ $l = 1 ]
do
- TIMESTAMP="$(date -u +%s)"
+ TIMESTAMP="$(_ak_datetime_unix)"
SHA="$(echo -n $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | sha512sum | awk '{ print $1 }')"
# Static difficulty for securing the sblock
echo $SHA | grep -e '^000'
diff --git a/bin/ak-network b/bin/ak-network
index f20d750..40efd72 100755
--- a/bin/ak-network
+++ b/bin/ak-network
@@ -22,10 +22,10 @@
##
## Usage:
##
-## -h, --help Prints this help message
-## -c, --connect [ipfs|cjdns] Connect to network(s)
-## -p, --peers [ipfs|cjdns|stellar|yggdrasil] Outputs peers found
-## -s, --scan [ipfs|cjdns|stellar|yggdrasil] Scan network(s) for peers
+## -h, --help Prints this help message
+## -c, --connect [ipfs|cjdns] Connect to network(s)
+## -p, --peers [ipfs|cjdns|stellar|yggdrasil|incoming] Outputs peers found
+## -s, --scan [ipfs|cjdns|stellar|yggdrasil|incoming] Scan network(s) for peers
##
## Bonus: CJDNS network scanning modes
##
@@ -37,9 +37,10 @@ PROGRAM=$(basename $0)
descriptionString="AK Nettool"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_network
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_network
# Flags to run
if [ ! -z $1 ]; then
diff --git a/bin/ak-node-info b/bin/ak-node-info
index 2b9c458..29eea87 100755
--- a/bin/ak-node-info
+++ b/bin/ak-node-info
@@ -29,9 +29,10 @@
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Quick description"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_node
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_node
if [ ! -z "$1" ]
then
diff --git a/bin/ak-ns b/bin/ak-ns
new file mode 100755
index 0000000..f638e07
--- /dev/null
+++ b/bin/ak-ns
@@ -0,0 +1,61 @@
+#!/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/>.
+###
+##
+## AKNS is a name system for Arching Kaos
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## -c, --create <name> Creates a new key-pair with name
+## -l, --list List names
+## -ll, --list-long List names with keys
+## -rn, --resolve-name <name> Resolves value from name
+## -rk, --resolve-key <key> Resolves value from key
+## -p, --publish <key> <value> Publishes value to key
+## -pn, --publish2name <name> <value> Publishes value to name
+## -pz, --publish-zchain Publishes zchain
+## -pc, --publish-config Publishes config
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="Name system"
+
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ns
+
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ -c | --create) shift; _ak_ns_create $1; exit;;
+ -l | --list) shift; _ak_ns_list; exit;;
+ -ll | --list-long) shift; _ak_ns_list_long; exit;;
+ -rn | --resolve-name) shift; _ak_ns_resolve_from_name $1; exit;;
+ -rk | --resolve-key) shift; _ak_ns_resolve_from_key $1; exit;;
+ -p | --publish) shift; _ak_ns_publish $1 $2; exit;;
+ -pn | --publish2name) shift; _ak_ns_publish2name $1 $2; exit;;
+ -pz | --publish-zchain) _ak_ns_publish_zchain; exit;;
+ -pc | --publish-config) _ak_ns_publish_config; exit;;
+ * ) _ak_usage;;
+ esac
+else _ak_usage
+fi
diff --git a/bin/ak-pkg b/bin/ak-pkg
new file mode 100755
index 0000000..d01921a
--- /dev/null
+++ b/bin/ak-pkg
@@ -0,0 +1,59 @@
+#!/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/>.
+###
+##
+## Manager of packages that can be installed and run as modules invoking the
+## `ak -m <module>` sequence.
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## --make-releases-from-local Makes releases from all local installation's module
+## --make-release-from-local Makes release from a local installation's module
+## --make-release-from-directory Makes release from a local directory
+## --install-from-zblock <zblock> Installs from a zblock
+## --install-from-akfs <maphash> Installs from an AKFS map
+## --uninstall Uninstalls a module selected from a menu
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="Package Manager"
+
+# At least these
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_pkg
+
+
+# Flags to run
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ --make-releases-from-local) shift; _ak_pkg_all_modules_make_releases_from_local_installation; exit;;
+ --make-release-from-local) _ak_pkg_all_modules_make_release_from_local_installation $1; exit;;
+ --make-release-from-directory) shift; _ak_pkg_all_modules_make_release_from_local_directory $1; exit;;
+ --install-from-zblock) shift; _ak_pkg_install_from_zblock $1; exit;;
+ --install-from-akfs) shift; _ak_pkg_install_from_akfsmap $1; exit;;
+ --uninstall) _ak_pkg_uninstall; exit;;
+ * ) _ak_usage;;
+ esac
+else _ak_usage
+fi
diff --git a/bin/ak-profile b/bin/ak-profile
index 97dcce3..02ed5a7 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -43,11 +43,13 @@ PROGRAM=$(basename $0)
descriptionString="Profile module"
ZPROFILEDIR="$AK_WORKDIR/profile"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
-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_datetime
+_ak_lib_load _ak_ipfs
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zblock
# Whatever the command is, we check if $ZPROFILEDIR is there.
# If NOT we create it and we change dir there.
@@ -66,7 +68,7 @@ cd $ZPROFILEDIR
# The profile settings/configuration is part of the blockchain produced.
# Hence, we need a specific DATA block that actually has the announcement of a
# {"key":"value"} pair.
-_ak_modules_profile_show(){
+function _ak_modules_profile_show(){
if [ ! -z $1 ]
then
_ak_log_info "Working with $1"
@@ -79,7 +81,7 @@ _ak_modules_profile_show(){
# This should retrieve a specific value from our profile otherwise it dumps the
# whole profile values.
-_ak_modules_profile_propget(){
+function _ak_modules_profile_propget(){
if [ ! -z $1 ]
then
if [ ! -f $ZPROFILEDIR/$1 ]
@@ -94,7 +96,7 @@ _ak_modules_profile_propget(){
fi
}
-_ak_modules_profile_propwrite(){
+function _ak_modules_profile_propwrite(){
cat > $ZPROPERTY_FILE << EOF
{
"$ZPROPERTY_KEY":"${ZPROPERTY_VALUE}"
@@ -113,7 +115,7 @@ EOF
fi
}
-_ak_modules_profile_propset(){
+function _ak_modules_profile_propset(){
if [ ! -z $1 ]
then
ZPROPERTY_FILE="$ZPROFILEDIR/$1"
@@ -148,7 +150,7 @@ _ak_modules_profile_propset(){
exit 244
fi
}
-_ak_modules_profile_index(){
+function _ak_modules_profile_index(){
FILES="$(ls -1 $ZPROFILEDIR)"
i=0
echo -n "{"
@@ -167,7 +169,7 @@ _ak_modules_profile_index(){
echo "}"
}
-_ak_modules_profile_import(){
+function _ak_modules_profile_import(){
if [ ! -z $1 ]
then
if [ ! -d $1 ]
@@ -190,7 +192,7 @@ _ak_modules_profile_import(){
}
# Adds a file as a profile/add ACTION on the zchain.
-_ak_modules_profile_add(){
+function _ak_modules_profile_add(){
TEMPASSIN="$(_ak_make_temp_directory)"
cd $TEMPASSIN
if [ -f $ZPROFILEDIR/$1 ]; then
@@ -202,7 +204,7 @@ _ak_modules_profile_add(){
FILE_SIGNATURE=$(_ak_ipfs_add $FILE_SIGN_FILE)
cat > data <<EOF
{
- "datetime":"$(date -u +%s)",
+ "datetime":"$(_ak_datetime_unix)",
"ipfs":"$FILE_IPFS_HASH",
"detach":"$FILE_SIGNATURE"
}
diff --git a/bin/ak-sblock b/bin/ak-sblock
index 742b6a9..7c6ab23 100755
--- a/bin/ak-sblock
+++ b/bin/ak-sblock
@@ -30,9 +30,10 @@ PROGRAM=$(basename $0)
descriptionString="Sblock tools"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_sblock
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_sblock
# Flags to run
if [ ! -z $1 ]
diff --git a/bin/ak-schain b/bin/ak-schain
index 2b5e80a..6efcd56 100755
--- a/bin/ak-schain
+++ b/