From d9a69f2f4c861946f43fb8c8cd4c7c431a6cf266 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 15 Dec 2024 06:11:19 +0200 Subject: New function in 'ak fs' '--net-cat-from-map --- LICENSE | 4 +- bin/ak | 39 ++++++++-- bin/ak-cjdns | 18 +++++ bin/ak-clean | 18 +++++ bin/ak-coin | 18 +++++ bin/ak-config | 18 +++++ bin/ak-fs | 19 +++++ bin/ak-get-balances | 18 +++++ bin/ak-gpg | 18 +++++ bin/ak-ipfs-daemon | 18 +++++ bin/ak-ipfs-starter | 18 +++++ bin/ak-json2bash | 18 +++++ bin/ak-log | 18 +++++ bin/ak-mempool | 18 +++++ bin/ak-mine | 18 +++++ bin/ak-network | 18 +++++ bin/ak-node-info | 18 +++++ bin/ak-profile | 18 +++++ bin/ak-sblock | 18 +++++ bin/ak-schain | 18 +++++ bin/ak-settings | 18 +++++ bin/ak-startup | 18 +++++ bin/ak-template | 18 +++++ bin/ak-transactions | 18 +++++ bin/ak-update | 18 +++++ bin/ak-zblock | 18 +++++ bin/ak-zchain | 18 +++++ install.sh | 167 +++++++++++++++++++++++++------------------ lib/_ak_cjdns | 18 +++++ lib/_ak_coin | 18 +++++ lib/_ak_config | 18 +++++ lib/_ak_fm | 18 +++++ lib/_ak_fs | 18 +++++ lib/_ak_gpg | 24 ++++++- lib/_ak_hash_exchange | 18 +++++ lib/_ak_html | 18 +++++ lib/_ak_ipfs | 18 +++++ lib/_ak_log | 24 ++++++- lib/_ak_network | 18 +++++ lib/_ak_node | 18 +++++ lib/_ak_sblock | 18 +++++ lib/_ak_schain | 18 +++++ lib/_ak_script | 60 ++++++++++++++-- lib/_ak_settings | 18 +++++ lib/_ak_smfiles | 18 +++++ lib/_ak_zblock | 19 ++++- lib/_ak_zchain | 18 +++++ modules/articles/main.sh | 20 +++++- modules/categories/main.sh | 20 +++++- modules/comments/main.sh | 20 +++++- modules/files/main.sh | 20 +++++- modules/folders/main.sh | 20 +++++- modules/follow/lib.sh | 18 +++++ modules/follow/main.sh | 20 +++++- modules/mixtapes/lib.sh | 20 +++++- modules/mixtapes/main.sh | 20 +++++- modules/news/lib.sh | 18 +++++ modules/news/main.sh | 20 +++++- modules/reference/main.sh | 20 +++++- modules/repositories/main.sh | 19 +++++ modules/roadmap/main.sh | 22 +++++- modules/smfiles/lib.sh | 18 +++++ modules/smfiles/main.sh | 20 +++++- modules/todos/main.sh | 21 +++++- 64 files changed, 1294 insertions(+), 100 deletions(-) diff --git a/LICENSE b/LICENSE index 60ba7b5..e610f57 100755 --- a/LICENSE +++ b/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Tools to interact and build an Arching Kaos Infochain - Copyright (C) 2021 - 2023 kaotisk + 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 @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - arching-kaos-tools Copyright (C) 2021 - 2023 kaotisk + arching-kaos-tools Copyright (C) 2021 - 2025 kaotisk This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/bin/ak b/bin/ak index 2d01ea5..8f6305f 100755 --- a/bin/ak +++ b/bin/ak @@ -1,4 +1,22 @@ #!/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 . +### export AK_DEBUG="yes" ## ## Arching Kaos CLI tool is the main executable script to use for exploring, @@ -29,6 +47,7 @@ source $AK_LIBDIR/_ak_script if [ $# -eq 0 ] then _ak_log_warning "No command given" + _ak_log_info "Available commands:" ( find $AK_BINDIR | grep 'ak-' | while read available do @@ -41,7 +60,7 @@ then #$(echo $subcmd) $args fi done - ) | sort | uniq + ) | sort | uniq | sed 's/^/# /g' | while read line; do _ak_log_info "$line";done exit 1 fi @@ -72,7 +91,7 @@ case "$1" in shift if [ ! -z $1 ] && [ -n "$1" ] then - grep -rnF "$1(){" $AK_BINDIR/* $AK_LIBDIR/* $AK_MODULESDIR/* + grep -rnF "$1(){" $AK_BINDIR/* $AK_LIBDIR/* $AK_MODULESDIR/* > /dev/null 2>&1 if [ $? -ne 0 ] then _ak_log_error "No function $1 found" @@ -85,13 +104,20 @@ case "$1" in fi filename="$(grep -rnF "$1(){" $AK_LIBDIR/* $AK_MODULESDIR/* | cut -d ':' -f 1)" line="$(grep -rnF "$1(){" $AK_LIBDIR/* $AK_MODULESDIR/* | cut -d ':' -f 2)" - functionname="$(grep -rnF "$1(){" $AK_LIBDIR/* $AK_MODULESDIR/* | cut -d ':' -f 3)" - printf 'Use with:\n' >&2 + functionname="$(grep -rnF "$1(){" $AK_LIBDIR/* $AK_MODULESDIR/* | cut -d ':' -f 3|sed -e 's/function //g')" + _ak_log_info "Use with:" printf 'source %s\n%s\n' "$filename" "$(echo -n $functionname | sed 's/(){//')" exit else + _ak_log_error "No function selected" + _ak_log_info "Available functions:" grep -rnF "(){" $AK_LIBDIR/* $AK_MODULESDIR/* | \ - sed -e "s#$AK_WORKDIR/##g" | sed -e 's/(){//g' | cut -d ':' -f 1,3 | tr ':' $'\t' + sed -e "s#$AK_WORKDIR/##g" | \ + sed -e 's/function //g;s/(){//g' | \ + cut -d ':' -f 1,3 | \ + tr ':' ' ' | \ + awk '{print $1 " " $2}' | \ + sort | while read line; do _ak_log_info "${line}"; done exit fi ;; @@ -104,7 +130,8 @@ case "$1" in if [ ! -n "$1" ] then _ak_log_error "No module selected" - ls -1 $AK_MODULESDIR + _ak_log_info "Modules available:" + ls -1 $AK_MODULESDIR | sed 's/^/# /g' | while read line; do _ak_log_info "$line";done exit 1 fi shift diff --git a/bin/ak-cjdns b/bin/ak-cjdns index 9219f19..d61a477 100755 --- a/bin/ak-cjdns +++ b/bin/ak-cjdns @@ -1,4 +1,22 @@ #!/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 . +### ## ## cjdns helper ## diff --git a/bin/ak-clean b/bin/ak-clean index f1d7f49..8e55515 100755 --- a/bin/ak-clean +++ b/bin/ak-clean @@ -1,4 +1,22 @@ #!/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 . +### ## ## Cleans up temporary directories and files ## diff --git a/bin/ak-coin b/bin/ak-coin index cd14602..0bd7f15 100755 --- a/bin/ak-coin +++ b/bin/ak-coin @@ -1,4 +1,22 @@ #!/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 . +### ## ## Coin status ## diff --git a/bin/ak-config b/bin/ak-config index 5d7b630..4337a2d 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -1,4 +1,22 @@ #!/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 . +### ## ## Usage: ak-config [ -h | --help | --show | --publish | --get-published ] ## diff --git a/bin/ak-fs b/bin/ak-fs index 9ca4e6b..74aedfa 100755 --- a/bin/ak-fs +++ b/bin/ak-fs @@ -1,4 +1,22 @@ #!/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 . +### ## ## Tools to add, get and cat files to/from the Arching Kaos File System ## @@ -9,6 +27,7 @@ ## --get, --export Exports a file from the AKFS system ## --cat Concatenates from given hash ## --list Lists names and roots available +## --net-cat-from-map Concatenates from map via the network ## fullprogrampath="$(realpath $0)" PROGRAM=$(basename $0) diff --git a/bin/ak-get-balances b/bin/ak-get-balances index 9fa7385..5b13999 100755 --- a/bin/ak-get-balances +++ b/bin/ak-get-balances @@ -1,4 +1,22 @@ #!/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 . +### ## ## Calculates the balances of the sblocks found from a chain ## Saves stuff too for later reference diff --git a/bin/ak-gpg b/bin/ak-gpg index 39dd6f6..e3169ca 100755 --- a/bin/ak-gpg +++ b/bin/ak-gpg @@ -1,4 +1,22 @@ #!/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 . +### ## ## It is a minimal wrapper aroung lib/_ak_gpg. ## diff --git a/bin/ak-ipfs-daemon b/bin/ak-ipfs-daemon index 3265966..e9a9bca 100755 --- a/bin/ak-ipfs-daemon +++ b/bin/ak-ipfs-daemon @@ -1,4 +1,22 @@ #!/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 . +### ## ## Starts IPFS daemon ## diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter index 7ce85c2..8076427 100755 --- a/bin/ak-ipfs-starter +++ b/bin/ak-ipfs-starter @@ -1,4 +1,22 @@ #!/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 . +### PROGRAM="$(basename $0)" source $AK_LIBDIR/_ak_log diff --git a/bin/ak-json2bash b/bin/ak-json2bash index 28a7e37..235d698 100755 --- a/bin/ak-json2bash +++ b/bin/ak-json2bash @@ -1,4 +1,22 @@ #!/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 . +### # # ak-json2bash # diff --git a/bin/ak-log b/bin/ak-log index 31f13e8..543d8ee 100755 --- a/bin/ak-log +++ b/bin/ak-log @@ -1,4 +1,22 @@ #!/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 . +### ## ## Used to overview, archive or append to the log file ## diff --git a/bin/ak-mempool b/bin/ak-mempool index 98c003a..d411ca2 100755 --- a/bin/ak-mempool +++ b/bin/ak-mempool @@ -1,4 +1,22 @@ #!/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 . +### ## ## Brief description ## diff --git a/bin/ak-mine b/bin/ak-mine index dd3e970..46e106d 100755 --- a/bin/ak-mine +++ b/bin/ak-mine @@ -1,4 +1,22 @@ #!/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 . +### ## ## You can mine sblocks for schain ## diff --git a/bin/ak-network b/bin/ak-network index b14f0d2..9ab0e52 100755 --- a/bin/ak-network +++ b/bin/ak-network @@ -1,4 +1,22 @@ #!/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 . +### ## ## Network tools ## diff --git a/bin/ak-node-info b/bin/ak-node-info index 21255c6..2b9c458 100755 --- a/bin/ak-node-info +++ b/bin/ak-node-info @@ -1,4 +1,22 @@ #!/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 . +### ## ## Brief description ## diff --git a/bin/ak-profile b/bin/ak-profile index c7d55c0..97dcce3 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -1,4 +1,22 @@ #!/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 . +### ## ## Indexes, shows, imports, adds, sets and gets values from and to the ## zchain and files. diff --git a/bin/ak-sblock b/bin/ak-sblock index dd6d764..742b6a9 100755 --- a/bin/ak-sblock +++ b/bin/ak-sblock @@ -1,4 +1,22 @@ #!/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 . +### ## ## Tools to show/read sblocks ## diff --git a/bin/ak-schain b/bin/ak-schain index cf166a5..2b5e80a 100755 --- a/bin/ak-schain +++ b/bin/ak-schain @@ -1,4 +1,22 @@ #!/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 . +### ## ## Various tools for schains ## diff --git a/bin/ak-settings b/bin/ak-settings index ec29f95..9465735 100755 --- a/bin/ak-settings +++ b/bin/ak-settings @@ -1,4 +1,22 @@ #!/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 . +### ## ## Set or get settings for your instance ## diff --git a/bin/ak-startup b/bin/ak-startup index 479bba5..0a18d77 100755 --- a/bin/ak-startup +++ b/bin/ak-startup @@ -1,4 +1,22 @@ #!/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 . +### ## ## Arching Kaos system starter ## diff --git a/bin/ak-template b/bin/ak-template index 85ecd0a..601a467 100755 --- a/bin/ak-template +++ b/bin/ak-template @@ -1,4 +1,22 @@ #!/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 . +### ## ## Brief description ## diff --git a/bin/ak-transactions b/bin/ak-transactions index 669b5b3..542579a 100755 --- a/bin/ak-transactions +++ b/bin/ak-transactions @@ -1,4 +1,22 @@ #!/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 . +### ## ## ak-transactions ## diff --git a/bin/ak-update b/bin/ak-update index a69f0ab..9dd5b10 100755 --- a/bin/ak-update +++ b/bin/ak-update @@ -1,4 +1,22 @@ #!/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 . +### if [ -L "${AK_WORKDIR}/bin/ak" ] then diff --git a/bin/ak-zblock b/bin/ak-zblock index 9a7caec..2292cec 100755 --- a/bin/ak-zblock +++ b/bin/ak-zblock @@ -1,4 +1,22 @@ #!/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 . +### ## ## Performs various operations on a zblock. Additionally, it can also pack one ## from given information, which can be added on top of your zchain. diff --git a/bin/ak-zchain b/bin/ak-zchain index f6370b9..d32aeb9 100755 --- a/bin/ak-zchain +++ b/bin/ak-zchain @@ -1,4 +1,22 @@ #!/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 . +### ## ## Tools for zchains ## diff --git a/install.sh b/install.sh index 850fc26..ced9e89 100755 --- a/install.sh +++ b/install.sh @@ -1,35 +1,101 @@ #!/usr/bin/env bash clear -printf "Arching Kaos Tools Installer\n" -printf "============================\n" -printf "Welcome to our ever involving installer\n" -printf "We will be as verbose as possible, yet minimal\n" -printf "Our default behaviour is to ask the less is needed\n" -printf "\n" -printf "For minimum overall friction, we will ask sudo access only if it's\n" -printf "needed for a missing package.\n" -printf "\n" -printf "We discourage running the installer with sudo.\n" -printf "\n" +printf '%s\n' "Arching Kaos Tools Installer" +printf '%s\n' "============================" +printf '%s\n' "Welcome to our ever involving installer" +printf '%s\n' "We will be as verbose as possible, yet minimal" +printf '%s\n' "Our default behaviour is to ask the less is needed" +printf '%s\n' "For minimum overall friction, we will ask sudo access only if it's" +printf '%s\n' "needed for a missing package." +printf '%s\n' "We discourage running the installer with sudo." +if [ -d ~/.arching-kaos ] +then + printf '%s\n' "Error: Found ~/.arching-kaos directory." + printf '%s\n' "Please backup your previous installationr and rerun ./install.sh." + exit 1 +fi + printf "Installation starts in..." -countdown=5 -printf " %s" "$countdown" -countdown="$(expr $countdown - 1)" -sleep 1 -while [ $countdown -gt 0 ] -do - if [ $countdown -lt 10 ] + +countdown_seconds(){ + default_countdown=5 + if [ ! -z "$1" ] && [ -n "$1" ] then - printf "\b\b %s" "$countdown" + if [ "$1" ~= '^[0-9]*$' ] + then + countdown=$1 + else + countdown=${default_countdown} + fi else - printf "\b\b%s" "$countdown" + countdown=${default_countdown} fi + printf " %s" "$countdown" countdown="$(expr $countdown - 1)" sleep 1 -done -printf "\b\b starting!!!" -sleep 1 -printf "\n" + while [ $countdown -gt 0 ] + do + if [ $countdown -lt 10 ] + then + printf "\b\b %s" "$countdown" + else + printf "\b\b%s" "$countdown" + fi + countdown="$(expr $countdown - 1)" + sleep 1 + done + printf "\b\b starting!!!" + sleep 1 + printf "\n" +} + +countdown_seconds 10 + + +source ./config.sh +if [ $? -ne 0 ] +then + printf "Error: Sourcing ./config.sh failed" + exit 2 +fi + +printf "%s" $(pwd) > wam +WHEREAMI="$(cat wam)" +if [ ! -d $AK_WORKDIR ] +then + mkdir $AK_WORKDIR +else + printf "Error: Found %s.\n" "$AK_WORKDIR" + printf "Please back up your previous installation\n" + printf "and rerun ./install.sh.\n" + exit 3 +fi + +touch $AK_LOGSFILE + +source ./lib/_ak_log +source ./lib/_ak_script + +_ak_check_and_create_dir $AK_CONFIGDIR +_ak_check_and_create_dir $AK_BINDIR +_ak_check_and_create_dir $AK_SETTINGS +_ak_check_and_create_dir $AK_LIBDIR +_ak_check_and_create_dir $AK_MODULESDIR +_ak_check_and_create_dir $AK_ZBLOCKDIR +_ak_check_and_create_dir $AK_BLOCKDIR +_ak_check_and_create_dir $AK_DATADIR +_ak_check_and_create_dir $AK_ARCHIVESDIR +_ak_check_and_create_dir $AK_MINEDBLOCKSDIR +_ak_check_and_create_dir $AK_CACHEDIR +_ak_check_and_create_dir $AK_CHUNKSDIR +_ak_check_and_create_dir $AK_LEAFSDIR +_ak_check_and_create_dir $AK_MAPSDIR +_ak_check_and_create_dir $AK_GPGHOME +chmod 700 -R $AK_GPGHOME +_ak_let_there_be_file $AK_GENESIS +_ak_let_there_be_file $AK_ZBLOCKSFILE +_ak_let_there_be_file $AK_ZPAIRSFILE + packageManager="" installCommand="" dontAskFlag="" @@ -93,10 +159,10 @@ do exit 1 fi printf "\t nvm installed!" - printf "\t Installing latest nodejs..." export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm - nvm install $(nvm ls-remote|tail -n 1) + [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" + printf "\t Installing latest nodejs..." + nvm install $(nvm ls-remote|tail -n 1|sed -e 's/ *//g') if [ $? -ne 0 ] then printf "\t Failed to install nodejs!\n" @@ -123,53 +189,17 @@ do done # Work-around for gpg2 calls on distros that don't provide a link -which gpg2 +which gpg2 > /dev/null 2>&1 if [ $? -ne 0 ] then - which gpg + which gpg > /dev/null 2>&1 if [ $? -eq 0 ] then $sudoBin ln -s `which gpg` /usr/bin/gpg2 fi fi -source ./config.sh -printf "%s" $(pwd) > wam -WHEREAMI="$(cat wam)" -if [ ! -d $AK_WORKDIR ] -then - mkdir $AK_WORKDIR -else - printf "Error: Found %s.\n" "$AK_WORKDIR" - printf "Please back up your previous installation\n" - printf "and rerun ./install.sh.\n" - exit 5 -fi -if [ ! -d $AK_CONFIGDIR ] ; then mkdir $AK_CONFIGDIR ;fi -if [ ! -d $AK_BINDIR ]; then mkdir $AK_BINDIR ;fi -if [ ! -d $AK_SETTINGS ]; then mkdir $AK_SETTINGS ;fi -if [ ! -d $AK_LIBDIR ]; then mkdir $AK_LIBDIR ;fi -if [ ! -d $AK_MODULESDIR ]; then mkdir $AK_MODULESDIR ;fi -if [ ! -d $AK_ZBLOCKDIR ]; then mkdir $AK_ZBLOCKDIR ;fi -if [ ! -d $AK_BLOCKDIR ]; then mkdir $AK_BLOCKDIR ;fi -if [ ! -d $AK_DATADIR ]; then mkdir $AK_DATADIR ;fi -if [ ! -d $AK_ARCHIVESDIR ]; then mkdir $AK_ARCHIVESDIR ;fi -if [ ! -f $AK_LOGSFILE ]; then touch $AK_LOGSFILE ;fi -if [ ! -f $AK_GENESIS ]; then touch $AK_GENESIS;fi -if [ ! -d $AK_MINEDBLOCKSDIR ]; then mkdir $AK_MINEDBLOCKSDIR; fi -if [ ! -f $AK_ZBLOCKSFILE ]; then touch $AK_ZBLOCKSFILE; fi -if [ ! -f $AK_ZPAIRSFILE ]; then touch $AK_ZPAIRSFILE; fi -if [ ! -d $AK_CACHEDIR ]; then mkdir $AK_CACHEDIR; fi -if [ ! -d $AK_GPGHOME ]; then mkdir $AK_GPGHOME && chmod 700 -R $AK_GPGHOME; fi -if [ ! -d $AK_CHUNKSDIR ]; then mkdir -p $AK_CHUNKSDIR; fi -if [ ! -d $AK_LEAFSDIR ]; then mkdir -p $AK_LEAFSDIR; fi -if [ ! -d $AK_MAPSDIR ]; then mkdir -p $AK_MAPSDIR; fi - -touch $AK_WORKDIR/logs -logthis(){ - echo "Install script: $1" >> $AK_WORKDIR/logs -} HAK=".arching-kaos" logthis "Searching for $HAK folder and files" @@ -195,8 +225,8 @@ then SHELLRC='.bashrc' logthis "BASH found"; else - logthis "Unknown shell... defaulting to bash" - SHELLRC='.bashrc' + logthis "Unknown shell... defaulting to ~/.profile" + SHELLRC='.profile' fi logthis "Searching if rc is already there" @@ -223,5 +253,6 @@ if [ $? -ne 0 ] then printf 'Building API daemon failed\n' exit 1 +else + ln -s $WHEREAMI/build/ak-daemon $AK_BINDIR/ak-daemon fi -ln -s $WHEREAMI/build/ak-daemon $AK_BINDIR/ak-daemon diff --git a/lib/_ak_cjdns b/lib/_ak_cjdns index f997690..30229ca 100755 --- a/lib/_ak_cjdns +++ b/lib/_ak_cjdns @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_network diff --git a/lib/_ak_coin b/lib/_ak_coin index e289841..dd895a0 100755 --- a/lib/_ak_coin +++ b/lib/_ak_coin @@ -1,4 +1,22 @@ #!/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 . +### # coin max is 10,000.0000000 # but we count in integer to avoid floating point arithmetic :P # diff --git a/lib/_ak_config b/lib/_ak_config index 252a4e2..0a4d55c 100755 --- a/lib/_ak_config +++ b/lib/_ak_config @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_node _ak_config_show(){ diff --git a/lib/_ak_fm b/lib/_ak_fm index 159f60c..8cc97e1 100755 --- a/lib/_ak_fm +++ b/lib/_ak_fm @@ -1,4 +1,22 @@ #!/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 . +### function _ak_fm_remove_line_from_file(){ tempfile="$(_ak_make_temp_file)" diff --git a/lib/_ak_fs b/lib/_ak_fs index 9a04ff0..c4adf11 100755 --- a/lib/_ak_fs +++ b/lib/_ak_fs @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_hash_exchange diff --git a/lib/_ak_gpg b/lib/_ak_gpg index 0d838f1..1450c60 100755 --- a/lib/_ak_gpg +++ b/lib/_ak_gpg @@ -1,9 +1,29 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_ipfs source $AK_LIBDIR/_ak_config source $AK_LIBDIR/_ak_settings +export AK_FINGERPRINT="$(_ak_settings_get gpg.fingerprint)" + _ak_gpg(){ gpg2 --homedir $AK_GPGHOME $* } @@ -13,8 +33,8 @@ _ak_gpg_check_or_create(){ if [ $? -ne 0 ] then _ak_gpg --batch --passphrase '' --quick-gen-key kaos@kaos.kaos rsa3072 sign 0 - AK_FINGERPRINT="$(_ak_gpg --list-keys | grep kaos@kaos.kaos -B 1 | head -n 1 | awk '{print $1}')" - _ak_gpg --batch --passphrase '' --quick-add-key $AK_FINGERPRINT rsa3072 encrypt 0 + FINGERPRINT="$(_ak_gpg --list-keys | grep kaos@kaos.kaos -B 1 | head -n 1 | awk '{print $1}')" + _ak_gpg --batch --passphrase '' --quick-add-key $FINGERPRINT rsa3072 encrypt 0 fi } diff --git a/lib/_ak_hash_exchange b/lib/_ak_hash_exchange index 80e5ae3..2e39658 100755 --- a/lib/_ak_hash_exchange +++ b/lib/_ak_hash_exchange @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_fm AK_TREEFS="$AK_WORKDIR/tree" diff --git a/lib/_ak_html b/lib/_ak_html index c31172e..5a47836 100755 --- a/lib/_ak_html +++ b/lib/_ak_html @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log _ak_generate_html_header(){ diff --git a/lib/_ak_ipfs b/lib/_ak_ipfs index 896db37..1297949 100755 --- a/lib/_ak_ipfs +++ b/lib/_ak_ipfs @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log AK_IPFS_REPO="$AK_WORKDIR/ipfsrepo" AK_IPFS_ARTIFACTS="$AK_WORKDIR/ipfs_artifacts" diff --git a/lib/_ak_log b/lib/_ak_log index a3ee259..f6ffc21 100755 --- a/lib/_ak_log +++ b/lib/_ak_log @@ -1,4 +1,22 @@ #!/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 . +### _ak_log_print_log_line(){ if [ -n "$1" ] @@ -78,7 +96,7 @@ _ak_log_message(){ then echo "$TS" "<$1>" "[ERROR]" "No message" >&2 fi - exit 1 + return 1 fi else echo "$TS" "<$1>" "[ERROR]" "No type and message" >> $AK_LOGSFILE @@ -86,7 +104,7 @@ _ak_log_message(){ then echo "$TS" "<$1>" "[ERROR]" "No type and message" >&2 fi - exit 1 + return 1 fi else echo "$TS" "<$(basename $0)>" "[ERROR]" "No arguments given" >> $AK_LOGSFILE @@ -94,7 +112,7 @@ _ak_log_message(){ then echo "$TS" "<$(basename $0)>" "[ERROR]" "No arguments given" >&2 fi - exit 1 + return 1 fi } diff --git a/lib/_ak_network b/lib/_ak_network index 39f0466..a6faf87 100755 --- a/lib/_ak_network +++ b/lib/_ak_network @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_ipfs diff --git a/lib/_ak_node b/lib/_ak_node index b4736d8..1cc009a 100755 --- a/lib/_ak_node +++ b/lib/_ak_node @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_ipfs # Resolves the IPNS key "ak-config" to its current IPFS value diff --git a/lib/_ak_sblock b/lib/_ak_sblock index fbe6913..6af345a 100755 --- a/lib/_ak_sblock +++ b/lib/_ak_sblock @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log diff --git a/lib/_ak_schain b/lib/_ak_schain index 136d1fd..a858fa7 100755 --- a/lib/_ak_schain +++ b/lib/_ak_schain @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_sblock diff --git a/lib/_ak_script b/lib/_ak_script index 96d5a51..33d712b 100755 --- a/lib/_ak_script +++ b/lib/_ak_script @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log # Wanna talk about it? @@ -26,7 +44,12 @@ function _ak_exit_program(){ function _ak_help(){ if [ ! -z $fullprogrampath ] && [ -n "$fullprogrampath" ] then - cat $fullprogrampath |grep '^##'| sed 's/^##//g;s/^ //g' 1>&2 + cat $fullprogrampath | grep -v '^###' | grep '^##'| sed 's/^##//g;s/^ //g' >&2 #| \ + # cat | while read line + # do + # echo -n "$line" | xxd + # _ak_log_info "$line" + # done exit 1 else _ak_log_error "fullprogrampath was not set" @@ -34,6 +57,16 @@ function _ak_help(){ fi } +function _ak_license(){ + if [ ! -z $fullprogrampath ] && [ -n "$fullprogrampath" ] + then + cat $fullprogrampath | grep '^###' | sed 's/^###//g;s/^ //g' >&2 + else + _ak_log_error "fullprogrampath was not set" + exit 1 + fi +} + function _ak_title_description(){ if [ ! -n "$descriptionString" ] then @@ -57,8 +90,11 @@ function _ak_title_description(){ } function _ak_usage(){ - _ak_title_description - _ak_help 2>&1 + ( + _ak_title_description 2>&1 + _ak_license 2>&1 + _ak_help 2>&1 + ) | sed 's/^/# /g' | while read line; do _ak_log_info "$line"; done } function _ak_print_version(){ @@ -114,7 +150,7 @@ function _ak_check_and_create_dir(){ mkdir -p "$1" if [ $? -eq 0 ] then - _ak_log_info "Folder $1 created!" + _ak_log_info "Directory $1 created!" else _ak_log_error "Problem occured while creating $1" exit 1 @@ -123,3 +159,19 @@ function _ak_check_and_create_dir(){ _ak_log_debug "$1 dir found" fi } + +function _ak_let_there_be_file(){ + if [ ! -f "$1" ] + then + touch "$1" + if [ $? -eq 0 ] + then + _ak_log_info "File $1 created!" + else + _ak_log_error "Problem occured while creating $1" + exit 1 + fi + else + _ak_log_debug "$1 file found" + fi +} diff --git a/lib/_ak_settings b/lib/_ak_settings index 5a38a1e..725ab5c 100755 --- a/lib/_ak_settings +++ b/lib/_ak_settings @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_script diff --git a/lib/_ak_smfiles b/lib/_ak_smfiles index f41d006..4663b45 100755 --- a/lib/_ak_smfiles +++ b/lib/_ak_smfiles @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log # The directory where the chunked data will be living at diff --git a/lib/_ak_zblock b/lib/_ak_zblock index 9b38d8f..6edf33c 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -1,4 +1,22 @@ #!/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 . +### #set -x source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_script @@ -110,7 +128,6 @@ _ak_data_expand(){ # Returns a JSON array representing the chain retrieved. # Logs messages to $LOGSFILE. _ak_zblock_show(){ - caller >&2 verify=1 if [ ! -z $1 ] && [ -n "$1" ] then diff --git a/lib/_ak_zchain b/lib/_ak_zchain index 4bc76a0..62f2c97 100755 --- a/lib/_ak_zchain +++ b/lib/_ak_zchain @@ -1,4 +1,22 @@ #!/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 . +### source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_ipfs source $AK_LIBDIR/_ak_zblock diff --git a/modules/articles/main.sh b/modules/articles/main.sh index 04033d0..c142725 100755 --- a/modules/articles/main.sh +++ b/modules/articles/main.sh @@ -1,4 +1,22 @@ #!/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 . +### ## ## -h, --help Prints this help message ## index Prints an indexed table of your articles files @@ -8,7 +26,7 @@ ## articlesletter and it's going to be saved ## fullprogrampath="$(realpath $0)" -PROGRAM=$(basename $0) +PROGRAM="ak-module-$(realpath $0 | rev |cut -d '/' -f 2 | rev)" descriptionString="Articles module for Arching Kaos" source $AK_LIBDIR/_ak_log diff --git a/modules/categories/main.sh b/modules/categories/main.sh index cd2d0dd..68d3c12 100755 --- a/modules/categories/main.sh +++ b/modules/categories/main.sh @@ -1,4 +1,22 @@ #!/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 Foundatio