aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak2
-rwxr-xr-xbin/ak-config16
-rwxr-xr-xbin/ak-ipfs-starter3
-rwxr-xr-xbin/ak-node-info14
-rwxr-xr-xbin/ak-profile6
-rwxr-xr-xbin/ak-startup14
6 files changed, 24 insertions, 31 deletions
diff --git a/bin/ak b/bin/ak
index c9f960e..539176a 100755
--- a/bin/ak
+++ b/bin/ak
@@ -64,7 +64,7 @@ case "$1" in
exit 1
fi
subargs="$*"
- $subcmd $subargs
+ $subcmd/main.sh $subargs
_ak_exit_program $? "$subcmd module finished";
;;
esac
diff --git a/bin/ak-config b/bin/ak-config
index 1655593..bda8564 100755
--- a/bin/ak-config
+++ b/bin/ak-config
@@ -17,6 +17,7 @@ descriptionString="Arching Kaos Configuration Tool"
source $AK_LIBDIR/_ak_script
source $AK_LIBDIR/_ak_gpg
source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_node
_ak_config_show(){
# We will be using our public key also to put it in the block later
@@ -29,9 +30,9 @@ _ak_config_show(){
echo '
{
"profile":'$profile',
- "genesis":"'$(cat $HOME/.arching-kaos/config/zgenesis)'",
+ "genesis":"'$(cat $AK_WORKDIR/config/zgenesis)'",
"gpg":"'$GPG_PUB_KEY'",
- "zchain":"'$(cat $HOME/.arching-kaos/config/zchain)'",
+ "zchain":"'$(cat $AK_WORKDIR/config/zchain)'",
"zlatest":"'$(ak-get-zlatest)'"
}'| jq;
}
@@ -39,12 +40,12 @@ _ak_config_show(){
_ak_config_publish(){
_ak_config_show | jq -c -M > tmpfile
_ak_ipfs key list | grep ak-config 2> /dev/null 1>&2
- if [ "$?" -ne 0 ]
+ if [ $? -ne 0 ]
then
- _ak_ipfs key gen ak-config
+ _ak_ipfs_key_gen ak-config
fi
_ak_ipfs_name_publish --key=ak-config /ipfs/$(_ak_ipfs_add tmpfile)
- if [ "$?" != 0 ]
+ if [ $? != 0 ]
then
echo -e "\033[0;34mError on publishing\033[0;0m\nYour information:\n"
cat tmpfile
@@ -54,10 +55,11 @@ _ak_config_publish(){
}
_ak_config_published(){
- _ak_ipfs_cat $(ak-node-info --ipfs) | jq
+ _ak_ipfs_cat $(_ak_node_info_ipfs_hash) | jq
}
-if [ ! -z $1 ]; then
+if [ ! -z $1 ] && [ -n "$1" ]
+then
case $1 in
--help| -h) _ak_usage;exit;;
--show) _ak_config_show;exit;;
diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter
index ae483f8..6b63c3c 100755
--- a/bin/ak-ipfs-starter
+++ b/bin/ak-ipfs-starter
@@ -2,8 +2,9 @@
PROGRAM="$(basename $0)"
source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_ipfs
-screen -dmS akipfsd ak-ipfs-daemon
+screen -dmS akipfsd _ak_ipfs_daemon
if [ $? -ne 0 ]
then
logit "ERROR" "Failed to start IPFS daemon"
diff --git a/bin/ak-node-info b/bin/ak-node-info
index b667fd3..42f6822 100755
--- a/bin/ak-node-info
+++ b/bin/ak-node-info
@@ -15,19 +15,7 @@ PROGRAM=$(basename $0)
descriptionString="Quick description"
source $AK_LIBDIR/_ak_log
source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
-# Resolves the IPNS key "ak-config" to its current IPFS value
-# Return IPFS CIDv0 without /ipfs/ prefix
-_ak_node_info_ipfs_hash(){
- _ak_ipfs_name_resolve /ipns/$(_ak_node_info_ipns_key) | sed -e 's/\/ipfs\///'
-}
-
-# Finds ak-config ipns key
-# Returns IPNS key
-_ak_node_info_ipns_key(){
- _ak_ipfs_key_list_full | grep ak-config | awk '{print $1}'
-}
-
+source $AK_LIBDIR/_ak_node
if [ ! -z "$1" ]
then
diff --git a/bin/ak-profile b/bin/ak-profile
index d513c9a..2fab750 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -81,7 +81,7 @@ _ak_modules_profile_propget(){
fi
}
-propwrite(){
+_ak_modules_profile_propwrite(){
cat > $ZPROPERTY_FILE << EOF
{
"$ZPROPERTY_KEY":"${ZPROPERTY_VALUE}"
@@ -113,7 +113,7 @@ _ak_modules_profile_propset(){
then
touch $ZPROPERTY_FILE
echo "$ZPROPERTY_KEY = $ZPROPERTY_VALUE in file $ZPROPERTY_FILE"
- propwrite #"$ZPROPERTY_FILE" "${ZPROPERTY_VALUE}"
+ _ak_modules_profile_propwrite #"$ZPROPERTY_FILE" "${ZPROPERTY_VALUE}"
else
echo "No value for $1"
fi
@@ -123,7 +123,7 @@ _ak_modules_profile_propset(){
ZPROPERTY_VALUE="$2"
read -p "Overwrite $1 with ${ZPROPERTY_VALUE} ? " yn
case $yn in
- [Yy]* ) propwrite;;# "$ZPROPERTY_" "${ZPROPERTY_VALUE}";;
+ [Yy]* ) _ak_modules_profile_propwrite;;# "$ZPROPERTY_" "${ZPROPERTY_VALUE}";;
[Nn]* ) exit 130;;
* ) echo "Answer please";;
esac
diff --git a/bin/ak-startup b/bin/ak-startup
index 7a67e58..87d1fe3 100755
--- a/bin/ak-startup
+++ b/bin/ak-startup
@@ -1,12 +1,14 @@
#!/bin/bash
-PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:$HOME/bin:$HOME/.arching-kaos/bin
-#screen -dmS ipfs-daemon ipfs daemon
source $HOME/.arching-kaos/rc
-ak-ipfs-starter
-ak-log-rotate
-# screen -dmS akdaemon
+PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:$HOME/bin:$AK_WORKDIR/bin
+
+source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_log
+_ak_ipfs_starter
+_ak_log_rotate
+
ak-daemon > $AK_WORKDIR/akd.log 2>&1 & printf '%s' "$!" > $AK_WORKDIR/akd.pid
if [ ! -z $1 ] && [ -n "$1" ] && [ "$1" == "--podman" ]
then
- ak log follow
+ _ak_log_follow
fi