aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak61
-rwxr-xr-xbin/ak-cjdns12
-rwxr-xr-xbin/ak-clean7
-rwxr-xr-xbin/ak-coin11
-rwxr-xr-xbin/ak-config11
-rwxr-xr-xbin/ak-fs13
-rwxr-xr-xbin/ak-get-balances22
-rwxr-xr-xbin/ak-gpg19
-rwxr-xr-xbin/ak-ipfs12
-rwxr-xr-xbin/ak-ipfs-starter5
-rwxr-xr-xbin/ak-irc12
-rwxr-xr-xbin/ak-log11
-rwxr-xr-xbin/ak-maintainance12
-rwxr-xr-xbin/ak-mempool5
-rwxr-xr-xbin/ak-mine12
-rwxr-xr-xbin/ak-network12
-rwxr-xr-xbin/ak-node-info11
-rwxr-xr-xbin/ak-ns73
-rwxr-xr-xbin/ak-pkg14
-rwxr-xr-xbin/ak-profile18
-rwxr-xr-xbin/ak-sblock12
-rwxr-xr-xbin/ak-schain12
-rwxr-xr-xbin/ak-settings12
-rwxr-xr-xbin/ak-sh11
-rwxr-xr-xbin/ak-startup12
-rwxr-xr-xbin/ak-template10
-rwxr-xr-xbin/ak-transactions13
-rwxr-xr-xbin/ak-wallet14
-rwxr-xr-xbin/ak-yggdrasil12
-rwxr-xr-xbin/ak-zblock12
-rwxr-xr-xbin/ak-zchain14
31 files changed, 331 insertions, 156 deletions
diff --git a/bin/ak b/bin/ak
index 8d86db8..0861d3b 100755
--- a/bin/ak
+++ b/bin/ak
@@ -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/>.
###
-export AK_DEBUG="yes"
+export AK_DEBUG=0
+export AK_DEBUG_IRC="no"
##
## Arching Kaos CLI tool is the main executable script to use for exploring,
## creating and distributing local blockchain(s) called zchain(s).
@@ -28,14 +29,16 @@ export AK_DEBUG="yes"
##
## Run with no arguments to see available commands
##
-## -h, --help Prints this help message
+## -h, --help Prints this help message.
##
-## -s, --shell Starts an interactive shell
+## -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
+## -f, --function [function] Get the list of available functions.
+##
+## -v Print all log messages.
##
## [command] [args] Run a command. If none provided a list of
## commands will be printed.
@@ -45,8 +48,46 @@ 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 [ "$1" == "-vi" ]
+then
+ export AK_DEBUG_IRC="yes"
+ export AK_DEBUG="no"
+ shift
+fi
+if [ "$1" == "-vn" ]
+then
+ export AK_DEBUG="no"
+ shift
+fi
+if [ "$1" == "-vvvvv" ]
+then
+ export AK_DEBUG=5
+ shift
+fi
+if [ "$1" == "-vvvv" ]
+then
+ export AK_DEBUG=4
+ shift
+fi
+if [ "$1" == "-vvv" ]
+then
+ export AK_DEBUG=3
+ shift
+fi
+if [ "$1" == "-vv" ]
+then
+ export AK_DEBUG=2
+ shift
+fi
+if [ "$1" == "-v" ]
+then
+ export AK_DEBUG=1
+ shift
+fi
if [ $# -eq 0 ]
then
@@ -60,11 +101,11 @@ then
args="-h"
if [ -n "$subcmd" ]
then
- echo $subcmd | cut -d '-' -f 2 | sort | uniq | sed -e 's/^/ak /g'
+ echo $subcmd | cut -d '-' -f 2 | sort | uniq #| sed -e 's/^/ak /g'
#$(echo $subcmd) $args
fi
done
- ) | sort | uniq | sed 's/^/# /g' | while read line; do _ak_log_info "$line";done
+ ) | sort | uniq #| sed 's/^/# /g' | while read line; do _ak_log_info "$line";done
exit 1
fi
@@ -153,7 +194,7 @@ case "$1" in
_ak_exit_program $? "$subcmd module finished";
;;
-s|--shell)
- ak sh -s
+ rlwrap ak sh -s
_ak_exit_program $? "Shell terminated";
;;
esac
@@ -178,7 +219,7 @@ else
fi
counter=$(($counter + 1))
done
- _ak_usage
+ # _ak_usage err
find $AK_BINDIR | while read available
do
echo $(basename $available) |\
diff --git a/bin/ak-cjdns b/bin/ak-cjdns
index d61a477..dfd6560 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 ]
@@ -46,7 +47,8 @@ then
--install) _ak_cjdns_install; exit;;
--connect) _ak_cjdns_connect_peers; exit;;
--ip) _ak_cjdns_get_ip; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-clean b/bin/ak-clean
index 675d34a..98d9c8c 100755
--- a/bin/ak-clean
+++ b/bin/ak-clean
@@ -35,7 +35,8 @@ 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
function _ak_tmp_cleanup(){
ls -1 /tmp/aktmp* > /dev/null 2>&1
@@ -53,8 +54,8 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
-c | --clean) _ak_tmp_cleanup; exit;;
- *) _ak_usage;
+ *) _ak_usage err;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-coin b/bin/ak-coin
index 0bd7f15..4f97dd2 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 ]
@@ -40,7 +41,7 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
--stats) _ak_coin_stats; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else _ak_usage err
fi
diff --git a/bin/ak-config b/bin/ak-config
index 4337a2d..ff8918f 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
@@ -42,8 +43,8 @@ then
--publish) _ak_config_publish;exit;;
--get-published) _ak_config_published;exit;;
--get-ipns-key) _ak_ipfs_get_config_ipns_key;exit;;
- *) _ak_usage;exit;;
+ *) _ak_usage err;exit;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-fs b/bin/ak-fs
index 84ef3b9..a7a0dca 100755
--- a/bin/ak-fs
+++ b/bin/ak-fs
@@ -27,6 +27,7 @@
## --get, --export <roothash> <output file> Exports a file from the AKFS system
## --cat <roothash> Concatenates from given hash
## --list Lists names and roots available
+## --llist Lists names available and their dates
## --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
@@ -36,9 +37,10 @@ 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
@@ -52,12 +54,13 @@ 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;;
--rhp) _ak_fs_return_hash_path $2; echo ; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-get-balances b/bin/ak-get-balances
index c25d2d1..a8ee44e 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"
@@ -285,9 +286,12 @@ function _ak_schain_counting_balances(){
fi
}
-if [ ! -z $1 ] && [ -n "$1" ]
+if [ ! -z $1 ] && [ -n "$1" ] && [ [ "$1" == "--help" ] || [ "$1" == "-h" ] ]
then
_ak_usage
+elif [ ! -z $1 ] && [ -n "$1" ]
+then
+ _ak_usage err
else
CUR_TARGET="$LATEST"
_ak_log_info "$CUR_TARGET $LATEST"
diff --git a/bin/ak-gpg b/bin/ak-gpg
index f84bc71..3bbd736 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -26,6 +26,8 @@
## --get-key-self-as-ipfs Returns your key as an IPFS hash
## --get-key-self-as-fingerprint Returns the fingerprint of your key
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
+## --export-key <fingerprint> <out> Exports a public key as <out> filename
+## --export-selected-key Selects a key to export
## --export-key-self-to-file Exports self public key as 'self.pub'
## --clear-sign <file> <output> Sign a file clearly
## --verify-file <file> Verify a clear signed file
@@ -39,6 +41,7 @@
## plain GPG output
## -lsl, --list-secret-keys-long Returns a list of secret GPG keys with
## their 1st uid
+## -i, --import-key <file> Imports a GPG key from a <file>
## -c, --create-key <email> Creates a GPG key with a label <email>
## -s, --select-key Selects the GPG key you want to use
## -d, --delete-key Delete GPG keys from your keyring
@@ -51,9 +54,10 @@ 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
@@ -61,11 +65,12 @@ source $AK_LIBDIR/_ak_gpg
if [ ! -z $1 ]; then
case $1 in
-h | --help) _ak_usage; exit;;
- --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) shift; _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
+ --export-selected-key) _ak_gpg_select_key_to_export; exit;;
+ --export-key) _ak_gpg_key_export "$2" "$3"; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
--verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
@@ -74,12 +79,14 @@ if [ ! -z $1 ]; then
--list-secret-keys | -ls) _ak_gpg_list_secret_keys; exit;;
--list-secret-keys-long | -lsl) _ak_gpg_list_secret_keys_long; exit;;
--list-secret-keys-plain | -lsp) _ak_gpg_list_secret_keys_plain; exit;;
+ --import-key | -i) shift; _ak_gpg_key_import_from_file $1; exit;;
--create-key | -c) shift; _ak_gpg_create_key $1; exit;;
--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;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-ipfs b/bin/ak-ipfs
index 376c3c0..ff66895 100755
--- a/bin/ak-ipfs
+++ b/bin/ak-ipfs
@@ -30,9 +30,10 @@ 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 ]
@@ -41,7 +42,8 @@ then
-h | --help) _ak_usage; exit;;
-d | --daemon) _ak_ipfs_starter; exit;;
-r | --run) shift; _ak_ipfs_runner $*; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
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
index d894158..1713da6 100755
--- a/bin/ak-irc
+++ b/bin/ak-irc
@@ -29,9 +29,10 @@ PROGRAM=$(basename $0)
descriptionString="IRC"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_irc
+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(){
@@ -45,7 +46,8 @@ then
-h | --help) _ak_usage; exit;;
--example) example; exit;;
--connect) _ak_irc_connect; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-log b/bin/ak-log
index 543d8ee..cf83c71 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,10 +49,12 @@ 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;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-maintainance b/bin/ak-maintainance
index 8490007..ea85211 100755
--- a/bin/ak-maintainance
+++ b/bin/ak-maintainance
@@ -33,9 +33,10 @@ PROGRAM=$(basename $0)
descriptionString="AK Backup"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_maintainance
+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 ]
@@ -45,8 +46,9 @@ then
-r | --restore) _ak_maintainance_restore $2; exit;;
-b | --backup) _ak_maintainance_backup; exit;;
-n | --nuke) _ak_maintainance_nuke_all_but_core; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-mempool b/bin/ak-mempool
index a994340..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.
diff --git a/bin/ak-mine b/bin/ak-mine
index 00c7458..53f7549 100755
--- a/bin/ak-mine
+++ b/bin/ak-mine
@@ -29,9 +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_utils
+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 ]
@@ -89,7 +90,8 @@ then
-h | --help) _ak_usage; exit;;
--example) example; exit;;
--mine) proofofwork; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-network b/bin/ak-network
index 9873d12..529d2ea 100755
--- a/bin/ak-network
+++ b/bin/ak-network
@@ -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
@@ -48,7 +49,8 @@ if [ ! -z $1 ]; then
-s | --scan) shift; _ak_network_scan $*; exit;;
-c | --connect) _ak_network_connect $2; exit;;
-p | --peers) _ak_network_show_peers $2; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-node-info b/bin/ak-node-info
index 2b9c458..b0a9663 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
@@ -46,9 +47,9 @@ then
_ak_node_info_ipns_key
;;
*)
- _ak_usage
+ _ak_usage err
;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-ns b/bin/ak-ns
new file mode 100755
index 0000000..94bdcd9
--- /dev/null
+++ b/bin/ak-ns
@@ -0,0 +1,73 @@
+#!/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
+## -rp, --resolve-key-proof <key> Resolves value from key and provides
+## an akfs_map_v3 to clear signed proof
+## -rj, --resolve-key-json <key> Resolves a key to a JSON format
+## -ra, --resolve-all Resolve all reachable keys
+## -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
+## -ek, --encode-key <key> Encodes a key to Base64
+## -dk, --decode-key <base64 key> Decodes a key from Base64
+##
+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;;
+ -rp | --resolve-key-proof) shift; _ak_ns_resolve_from_key_with_proof $1; exit;;
+ -rj | --resolve-key-json) shift; _ak_ns_resolve_from_key_with_proof_json $1; exit;;
+ -ra | --resolve-all) _ak_ns_resolve_all_keys; exit;;
+ -ek | --encode-key) shift; _ak_ns_encode_key $1; exit;;
+ -dk | --decode-key) shift; _ak_ns_decode_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 err;;
+ esac
+else
+ _ak_usage err
+fi
diff --git a/bin/ak-pkg b/bin/ak-pkg
index 971aab6..940c084 100755
--- a/bin/ak-pkg
+++ b/bin/ak-pkg
@@ -26,6 +26,7 @@
## -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
@@ -35,9 +36,10 @@ PROGRAM=$(basename $0)
descriptionString="Package Manager"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_pkg
-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_pkg
# Flags to run
@@ -47,10 +49,12 @@ then
-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;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-profile b/bin/ak-profile
index 4232b55..eaf8e0b 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -43,12 +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_utils
-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.
@@ -234,7 +235,8 @@ if [ ! -z $1 ]; then
-a | --add) _ak_modules_profile_add $2; exit;;
-s | --set) _ak_modules_profile_propset $2 "$3"; exit;;
-g | --get) _ak_modules_profile_propget $2; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-sblock b/bin/ak-sblock
index 742b6a9..ec7464e 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 ]
@@ -40,7 +41,8 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
-s | --show) shift; _ak_sblock_show $1; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-schain b/bin/ak-schain
index 2b5e80a..90b2cb0 100755
--- a/bin/ak-schain
+++ b/bin/ak-schain
@@ -32,9 +32,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Schain tools"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_schain
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_schain
# Flags to run
if [ ! -z $1 ]
@@ -43,7 +44,8 @@ then
-h | --help) _ak_usage; exit;;
-c | --crawl) shift; _ak_schain_crawl_interface $*; exit;;
-l | --get-latest) _ak_schain_get_latest; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-settings b/bin/ak-settings
index 9465735..32028fd 100755
--- a/bin/ak-settings
+++ b/bin/ak-settings
@@ -31,9 +31,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Settings helper program"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_settings
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_settings
if [ ! -z "$AK_SETTINGS" ] && [ -n "$AK_SETTINGS" ]
then
@@ -60,7 +61,8 @@ if [ ! -z $1 ]; then
-h | --help) _ak_usage; exit;;
-g | --get) _ak_settings_get "$2" ; exit;;