aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-06-14 22:36:12 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-06-14 22:36:12 +0300
commit4217dc0560bf40b4fa7ae6a6f964bd56b418712e (patch)
tree020e304e23b29d0eb12199c2f605f1262a3beb04
parent7743751290bb4e7678940be65725a48386e7b986 (diff)
downloadarching-kaos-tools-4217dc0560bf40b4fa7ae6a6f964bd56b418712e.tar.gz
arching-kaos-tools-4217dc0560bf40b4fa7ae6a6f964bd56b418712e.tar.bz2
arching-kaos-tools-4217dc0560bf40b4fa7ae6a6f964bd56b418712e.zip
Refactoring
-rwxr-xr-xbin/ak8
-rwxr-xr-xbin/ak-data-expand32
-rwxr-xr-xbin/ak-enter2
-rwxr-xr-xbin/ak-find-latest-mined-sblock18
-rwxr-xr-xbin/ak-follow4
-rwxr-xr-xbin/ak-following2
-rwxr-xr-xbin/ak-fs-add28
-rwxr-xr-xbin/ak-ipfs-starter2
-rwxr-xr-xbin/ak-mempool2
-rwxr-xr-xbin/ak-profile6
-rwxr-xr-xbin/ak-sm-filejoiner2
-rwxr-xr-xbin/ak-sm-files48
-rwxr-xr-xbin/ak-sm-filesplitter18
-rwxr-xr-xbin/ak-stellar-get-participants8
-rwxr-xr-xbin/ak-tempassin4
-rwxr-xr-xbin/ak-transactions2
-rwxr-xr-xbin/ak-unfollow4
-rwxr-xr-xbin/ak-zchain-chk22
-rwxr-xr-xinstall.sh63
-rwxr-xr-xlib/_ak_fm10
-rwxr-xr-xlib/_ak_gpg6
-rwxr-xr-xlib/_ak_ipfs112
-rwxr-xr-xlib/_ak_script8
-rwxr-xr-xlib/_ak_zblock100
-rwxr-xr-xlib/_ak_zchain4
-rwxr-xr-xmodules/articles/main.sh10
-rwxr-xr-xmodules/categories/main.sh20
-rwxr-xr-xmodules/comments/main.sh8
-rwxr-xr-xmodules/files/main.sh36
-rwxr-xr-xmodules/folders/main.sh18
-rwxr-xr-xmodules/news/main.sh28
-rwxr-xr-xmodules/reference/main.sh4
-rwxr-xr-xmodules/todos/main.sh16
33 files changed, 315 insertions, 340 deletions
diff --git a/bin/ak b/bin/ak
index 4d5e9d2..07deae2 100755
--- a/bin/ak
+++ b/bin/ak
@@ -21,7 +21,7 @@ source $AK_WORKDIR/rc
if [ $# -eq 0 ]
then
- logit "WARNING" "No command given"
+ _ak_log_warning "No command given"
(
find $AK_BINDIR | grep 'ak-' | while read available
do
@@ -59,7 +59,7 @@ case "$1" in
shift
if [ -z $1 ] || [ ! -n "$*" ]
then
- logit "ERROR" "No module selected"
+ _ak_log_error "No module selected"
ls -1 $AK_MODULESDIR
exit 1
fi
@@ -83,7 +83,7 @@ else
args="$(echo "$argv"| cut -d ' ' -f $(($counter + 1))-)"
if [ -n "$subcmd" ] && [ -f "$AK_BINDIR/ak-$subcmd" ]
then
- logit "INFO" "Running: ak-$subcmd with args: $args"
+ _ak_log_info "Running: ak-$subcmd with args: $args"
$(echo ak-$subcmd) $args
_ak_exit_program $? "ak-$subcmd command finished";
fi
@@ -95,6 +95,6 @@ else
grep ak-$(echo $argv | cut -d ' ' -f 1) |\
sed -e 's/-/ /g'
done
- logit "ERROR" "Unknown subcommand: $*"
+ _ak_log_error "Unknown subcommand: $*"
exit 1
fi
diff --git a/bin/ak-data-expand b/bin/ak-data-expand
index 8ee54c9..be51d18 100755
--- a/bin/ak-data-expand
+++ b/bin/ak-data-expand
@@ -14,87 +14,87 @@ then
echo -n "$1" | grep -e 'Qm.\{44\}' >/dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Invalid hash format for $1"
+ _ak_log_error "Invalid hash format for $1"
exit 1
fi
_ak_ipfs_cat $1 > /dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while reading $1"
+ _ak_log_error "Error while reading $1"
exit 1
fi
_ak_ipfs_cat $1 | jq -M > /dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while parsing JSON for $1"
+ _ak_log_error "Error while parsing JSON for $1"
exit 1
fi
_ak_ipfs_cat $1 | jq | grep ipfs > /dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while extracting data from JSON for $1"
+ _ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
DATA="$(_ak_ipfs_cat $1 | jq | grep ipfs | sed -e 's/"ipfs": "//g; s/[",]//g; s/ //g')"
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while extracting data from JSON for $1"
+ _ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
_ak_ipfs_cat $1 | jq | grep detach > /dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while extracting data from JSON for $1"
+ _ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
DETACH="$(_ak_ipfs_cat $1 | jq | grep detach | sed -e 's/"detach": "//g; s/[",]//g; s/ //g')"
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while extracting data from JSON for $1"
+ _ak_log_error "Error while extracting data from JSON for $1"
exit 1
fi
echo -n "$2" | grep -e 'Qm.\{44\}' >/dev/null
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Invalid hash format for $2"
+ _ak_log_error "Invalid hash format for $2"
exit 1
fi
gpg="$2"
_ak_ipfs_get $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Could not get GPG key: $gpg"
+ _ak_log_error "Could not get GPG key: $gpg"
exit 1
fi
_ak_gpg_key_import_from_file $gpg > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Could not import GPG key: $gpg"
+ _ak_log_error "Could not import GPG key: $gpg"
exit 1
fi
_ak_ipfs_get $DETACH > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while getting signature: $DETACH for data: $DATA"
+ _ak_log_error "Error while getting signature: $DETACH for data: $DATA"
exit 1
fi
mv $DETACH $DATA.asc
- logit "INFO" "Block signature downloaded"
+ _ak_log_info "Block signature downloaded"
_ak_ipfs_get $DATA > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while getting data: $DATA"
+ _ak_log_error "Error while getting data: $DATA"
exit 1
fi
- logit "INFO" "Data downloaded: $DATA"
+ _ak_log_info "Data downloaded: $DATA"
_ak_gpg_verify_signature $DATA.asc $DATA > /dev/null 2>&1
if [ "$?" -ne 0 ]
then
- logit "ERROR" "Error while verifying signature for $DATA"
+ _ak_log_error "Error while verifying signature for $DATA"
exit 1
fi
mv $DATA $AK_WORKDIR/ipfs
- logit "INFO" "Block signature verified"
+ _ak_log_info "Block signature verified"
echo -n '"data":"'$1'","'$1'":'$(_ak_ipfs_cat $1|jq -M -c)','
exit 0
else
diff --git a/bin/ak-enter b/bin/ak-enter
index 4537d2f..59bb943 100755
--- a/bin/ak-enter
+++ b/bin/ak-enter
@@ -69,7 +69,7 @@ while [ "$#" ]; do
entrance="$(_ak_ipns_resolve $1)"
if [ $? -ne 0 ]
then
- logit "ERROR" "Could not resolve IPNS name"
+ _ak_log_error "Could not resolve IPNS name"
exit 1
fi
shift
diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock
index 772e884..effe1bb 100755
--- a/bin/ak-find-latest-mined-sblock
+++ b/bin/ak-find-latest-mined-sblock
@@ -15,7 +15,7 @@ then
fi
further(){
- # logit "INFO" "Diving into $1"
+ # _ak_log_info "Diving into $1"
lookfor $1
}
@@ -23,7 +23,7 @@ lookfor(){
echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null
if [ ! $? = 0 ]
then
- logit "ERROR" "Oops!!! The argument passed, does not match the regular expression!"
+ _ak_log_error "Oops!!! The argument passed, does not match the regular expression!"
else
counters[$CHAIN_PARENT]="$(expr ${counters[$CHAIN_PARENT]} + 1)"
if [ ! $? = 0 ]
@@ -31,21 +31,21 @@ lookfor(){
echo "$1, $counters[$1]"
exit 1
fi
- logit "INFO" "Accessing file: $1"
+ _ak_log_info "Accessing file: $1"
# echo "$1 file:"
# cat "$1" | jq
NEXT_TARGET="$(cat "$1" | jq | grep previous | tr -d ' ' | sed -e 's/previous//g; s/[",:]//g;')"
if [ ! "$NEXT_TARGET" = "" ]
then
- logit "INFO" "Found previous: $NEXT_TARGET"
+ _ak_log_info "Found previous: $NEXT_TARGET"
if [ ! -f "$NEXT_TARGET" ]
then
- logit "WARNING" "Could not find $NEXT_TARGET"
+ _ak_log_warning "Could not find $NEXT_TARGET"
else
further "$NEXT_TARGET"
fi
else
- logit "WARNING" "No next target found. So long for $1"
+ _ak_log_warning "No next target found. So long for $1"
fi
fi
}
@@ -58,12 +58,12 @@ do
if [ "$(echo $p | tr -d '\n' | wc -c)" = 128 ]
then
filename="$(basename $p)"
- logit "INFO" "Investigating $filename..."
+ _ak_log_info "Investigating $filename..."
export CHAIN_PARENT="$filename"
counters[$CHAIN_PARENT]=1
lookfor "$filename"
else
- logit "WARNING" "Nothing to do with $filename"
+ _ak_log_warning "Nothing to do with $filename"
fi
done < $templistblock
rm $templistblock
@@ -76,7 +76,7 @@ do
then
max="${counters[${value}]}"
max_holder="${value}"
- logit "INFO" "New MAX $max on $max_holder"
+ _ak_log_info "New MAX $max on $max_holder"
fi
done
echo '{"latest_block":"'$max_holder'"}'
diff --git a/bin/ak-follow b/bin/ak-follow
index fd32d3a..c289b0f 100755
--- a/bin/ak-follow
+++ b/bin/ak-follow
@@ -9,14 +9,14 @@ then
grep $1 $FOLLOWING
if [ $? == 0 ]
then
- logit "ERROR" "Already exists"
+ _ak_log_error "Already exists"
exit 1
fi
echo $1 >> $FOLLOWING
IPFS=$(_ak_ipfs_add $FOLLOWING)
if [ $? != 0 ]
then
- logit "ERROR" "Addition failed"
+ _ak_log_error "Addition failed"
exit 1
fi
ak-profile set following $IPFS
diff --git a/bin/ak-following b/bin/ak-following
index 7b37be3..734f6ed 100755
--- a/bin/ak-following
+++ b/bin/ak-following
@@ -7,7 +7,7 @@ if [ -f $FOLLOWING ]
then
cat $FOLLOWING
else
- logit "INFO" "No following file, creating"
+ _ak_log_info "No following file, creating"
touch $FOLLOWING
echo "None found"
fi
diff --git a/bin/ak-fs-add b/bin/ak-fs-add
index 0a9f636..3f48d48 100755
--- a/bin/ak-fs-add
+++ b/bin/ak-fs-add
@@ -29,7 +29,7 @@ source $AK_LIBDIR/_ak_log
if [ ! -f "$1" ]
then
- logit "ERROR" "File $1 not found"
+ _ak_log_error "File $1 not found"
exit 1
else
# TODO
@@ -67,13 +67,13 @@ then
mkdir -p "$TECHDIR"
if [ $? -eq 0 ]
then
- logit "INFO" "Folder $TECHDIR created!"
+ _ak_log_info "Folder $TECHDIR created!"
else
- logit "ERROR" "Problem occured while creating $TECHDIR"
+ _ak_log_error "Problem occured while creating $TECHDIR"
exit 1
fi
else
- logit "INFO" "Temp dir found"
+ _ak_log_info "Temp dir found"
fi
# FILEMAPSDIR
@@ -82,13 +82,13 @@ then
mkdir -p "$FILEMAPSDIR"
if [ $? -eq 0 ]
then
- logit "INFO" "Folder $FILEMAPSDIR created!"
+ _ak_log_info "Folder $FILEMAPSDIR created!"
else
- logit "ERROR" "Problem occured while creating $FILEMAPSDIR"
+ _ak_log_error "Problem occured while creating $FILEMAPSDIR"
exit 1
fi
else
- logit "INFO" "Mapsdir found"
+ _ak_log_info "Mapsdir found"
fi
# CHKDIR
@@ -97,13 +97,13 @@ then
mkdir -p "$CHKDIR"
if [ $? -eq 0 ]
then
- logit "INFO" "Folder $CHKDIR created!"
+ _ak_log_info "Folder $CHKDIR created!"
else
- logit "ERROR" "Problem occured while creating $CHKDIR"
+ _ak_log_error "Problem occured while creating $CHKDIR"
exit 1
fi
else
- logit "INFO" "Workdir found"
+ _ak_log_info "Workdir found"
fi
# MERKLEDIR
@@ -112,14 +112,14 @@ then
mkdir -p "$MERKLEDIR"
if [ $? -eq 0 ]
then
- logit "INFO" "Folder $MERKLEDIR created!"
+ _ak_log_info "Folder $MERKLEDIR created!"
else
- logit "ERROR" "Problem occured while creating $MERKLEDIR"
+ _ak_log_error "Problem occured while creating $MERKLEDIR"
echo "ERROR Can't create $MERKLEDIR"
exit 1
fi
else
- logit "INFO" "Workdir found"
+ _ak_log_info "Workdir found"
fi
# Uncomment next line in case you want to debug the resulting script as well
# echo 'set -xe' > $TEMPORARYDIR/cmd_queue.sh
@@ -136,7 +136,7 @@ else
do
FACTOR=$(( $FACTOR * 2 ))
done
- logit "INFO" "Gonna split in $FACTOR size"
+ _ak_log_info "Gonna split in $FACTOR size"
sleep 30
# We split the file into 4*1024 bytes and output the chunks into TECHDIR
split -a 50 -b $FACTOR --additional-suffix ".chk" -d "$FILE" "$TECHDIR/$(basename "$FILE")-"
diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter
index 6b63c3c..3a7df29 100755
--- a/bin/ak-ipfs-starter
+++ b/bin/ak-ipfs-starter
@@ -7,6 +7,6 @@ source $AK_LIBDIR/_ak_ipfs
screen -dmS akipfsd _ak_ipfs_daemon
if [ $? -ne 0 ]
then
- logit "ERROR" "Failed to start IPFS daemon"
+ _ak_log_error "Failed to start IPFS daemon"
exit 1
fi
diff --git a/bin/ak-mempool b/bin/ak-mempool
index cb659c2..bcf56ad 100755
--- a/bin/ak-mempool
+++ b/bin/ak-mempool
@@ -13,7 +13,7 @@ _ak_ipfs_swarm_peers > tmp_peers
while IFS="" read -r p || [ -n "$p" ]
do
peer="$(echo "$p" | sed -e 's/^.*\///')"
- logit "INFO" "Peer $peer found! Examining..."
+ _ak_log_info "Peer $peer found! Examining..."
_ak_ipfs_cat /ipns/$peer/zlatest
done < tmp_peers
diff --git a/bin/ak-profile b/bin/ak-profile
index 2fab750..1712575 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -43,9 +43,9 @@ source $AK_LIBDIR/_ak_zblock
if [ ! -d $ZPROFILEDIR ]; then
mkdir $ZPROFILEDIR
cd $ZPROFILEDIR
- logit "INFO" "zprofiledir created"
+ _ak_log_info "zprofiledir created"
else
- logit "INFO" "zprofiledir found"
+ _ak_log_info "zprofiledir found"
fi
# This is working with DATA blocks. DATA that matched profile/add ACTION
@@ -56,7 +56,7 @@ fi
_ak_modules_profile_show(){
if [ ! -z $1 ]
then
- logit "INFO" "Working with $1"
+ _ak_log_info "Working with $1"
_ak_ipfs_cat $(echo $(_ak_ipfs_cat $1) | jq '.ipfs' -r)
else
echo "No DATA provided"
diff --git a/bin/ak-sm-filejoiner b/bin/ak-sm-filejoiner
index 3f3604c..9264a9a 100755
--- a/bin/ak-sm-filejoiner
+++ b/bin/ak-sm-filejoiner
@@ -74,7 +74,7 @@ then
# We check if everything is okay
sha512sum -c $MAPSDIR/$MAPSFILE
if [ "$?" != "0" ]; then
- logit "ERROR" "Error while checking sums"
+ _ak_log_error "Error while checking sums"
exit 1
fi
diff --git a/bin/ak-sm-files b/bin/ak-sm-files
index ba4d851..d0514f8 100755
--- a/bin/ak-sm-files
+++ b/bin/ak-sm-files
@@ -14,14 +14,14 @@ if [ ! -d $ZFILESDIR ]; then
mkdir $ZFILESDIR
if [ $? == 0 ]
then
- logit "INFO" "Folder $ZFILESDIR created!"
+ _ak_log_info "Folder $ZFILESDIR created!"
else
- logit "ERROR" "Failed to create $ZFILESDIR folder"
+ _ak_log_error "Failed to create $ZFILESDIR folder"
exit 1
fi
cd $ZFILESDIR
else
- logit "INFO" "$ZFILESDIR found!"
+ _ak_log_info "$ZFILESDIR found!"
fi
usage(){
@@ -46,61 +46,61 @@ main(){
cd $TEMPASSIN
echo "Adding $FILENAME"
- logit "INFO" "Switching to tmp folder..."
+ _ak_log_info "Switching to tmp folder..."
if [ $? == 0 ]; then
- logit "INFO" "Success"
+ _ak_log_info "Success"
else
- logit "ERROR" "Error with tmp folder"
+ _ak_log_error "Error with tmp folder"
exit 5
fi
- logit "INFO" "Copying $1 to $TEMPASSIN"
+ _ak_log_info "Copying $1 to $TEMPASSIN"
cp $CRP/$FILENAME $FILENAME
if [ $? == 0 ]; then
- logit "INFO" "Copied successfully"
+ _ak_log_info "Copied successfully"
else
- logit "ERROR" "Error copying..."
+ _ak_log_error "Error copying..."
fi
- logit "INFO" "Adding $FILENAME to IPFS..."
+ _ak_log_info "Adding $FILENAME to IPFS..."
FILE_IPFS_HASH=$(_ak_ipfs_add $FILENAME)
if [ $? == 0 ]; then
- logit "INFO" "Added $FILENAME to IPFS"
+ _ak_log_info "Added $FILENAME to IPFS"
else
- logit "ERROR" "Error in adding the $FILENAME to IPFS"
+ _ak_log_error "Error in adding the $FILENAME to IPFS"
fi
- logit "INFO" "Adding $FILE to SHAMAPSYS..."
+ _ak_log_info "Adding $FILE to SHAMAPSYS..."
FILEMAP_SHA512_HASH=$(ak-sm-filesplitter $FILENAME)
if [ $? == 0 ]; then
- logit "INFO" "Added $FILENAME to SHAMAPSYS"
+ _ak_log_info "Added $FILENAME to SHAMAPSYS"
else
- logit "ERROR" "Error in adding the $FILENAME to SHAMAPSYS"
+ _ak_log_error "Error in adding the $FILENAME to SHAMAPSYS"
fi
- logit "INFO" "Signing..."
+ _ak_log_info "Signing..."
SIGN_FILE=$FILENAME".asc"
_ak_gpg_sign_detached $SIGN_FILE $FILENAME
if [ $? == 0 ]; then
- logit "INFO" "Signed"
+ _ak_log_info "Signed"
else
- logit "ERROR" "Error while signing"
+ _ak_log_error "Error while signing"
fi
- logit "INFO" "Adding signature to IPFS"
+ _ak_log_info "Adding signature to IPFS"
SIGNATURE=$(_ak_ipfs_add $SIGN_FILE)
if [ $? == 0 ]; then
- logit "INFO" "Added"
+ _ak_log_info "Added"
else
- logit "ERROR" "Error while adding"
+ _ak_log_error "Error while adding"
fi
- logit "INFO" "Adding signature to SHAMAPSYS"
+ _ak_log_info "Adding signature to SHAMAPSYS"
SHAMAPSIGMAP=$(ak-sm-filesplitter $SIGN_FILE)
if [ $? == 0 ]; then
- logit "INFO" "Added"
+ _ak_log_info "Added"
else
- logit "ERROR" "Error while adding"
+ _ak_log_error "Error while adding"
fi
cat > data <<EOF
diff --git a/bin/ak-sm-filesplitter b/bin/ak-sm-filesplitter
index f9f5cff..7365b19 100755
--- a/bin/ak-sm-filesplitter
+++ b/bin/ak-sm-filesplitter
@@ -51,14 +51,14 @@ then
mkdir -p "$TECHDIR"
if [ "$?" == 0 ]
then
- logit "INFO" "Folder $TECHDIR created!"
+ _ak_log_info "Folder $TECHDIR created!"
else
- logit "ERROR" "Problem occured while creating $TECHDIR"
+ _ak_log_error "Problem occured while creating $TECHDIR"
echo "ERROR Can't create $TECHDIR"
exit 1
fi
else
- logit "INFO" "Temp dir found"
+ _ak_log_info "Temp dir found"
fi
# FILEMAPSDIR
@@ -67,14 +67,14 @@ then
mkdir -p "$FILEMAPSDIR"
if [ "$?" == 0 ]
then
- logit "INFO" "Folder $FILEMAPSDIR created!"
+ _ak_log_info "Folder $FILEMAPSDIR created!"
else
- logit "ERROR" "Problem occured while creating $FILEMAPSDIR"
+ _ak_log_error "Problem occured while creating $FILEMAPSDIR"
echo "ERROR Can't create $FILEMAPSDIR"
exit 1
fi
else
- logit "INFO" "Mapsdir found"
+ _ak_log_info "Mapsdir found"
fi
# CHKDIR
@@ -83,14 +83,14 @@ then
mkdir -p "$CHKDIR"
if [ "$?" == 0 ]
then
- logit "INFO" "Folder $CHKDIR created!"
+ _ak_log_info "Folder $CHKDIR created!"
else
- logit "ERROR" "Problem occured while creating $CHKDIR"
+ _ak_log_error "Problem occured while creating $CHKDIR"
echo "ERROR Can't create $CHKDIR"
exit 1
fi
else
- logit "INFO" "Workdir found"
+ _ak_log_info "Workdir found"
fi
# Uncomment next line in case you want to debug the resulting script as well
diff --git a/bin/ak-stellar-get-participants b/bin/ak-stellar-get-participants
index dfaf78d..779e9e1 100755
--- a/bin/ak-stellar-get-participants
+++ b/bin/ak-stellar-get-participants
@@ -48,9 +48,9 @@ show_ids(){
if [ "$flag" == "0" ]
then
echo $test >> $stellarParticipants
- logit "INFO" "Added $test"
+ _ak_log_info "Added $test"
else
- logit "INFO" "$test already there. Skipping..."
+ _ak_log_info "$test already there. Skipping..."
fi
i="$(expr $i + 1)"
done
@@ -103,9 +103,9 @@ do
if [ "$flag" == "0" ]
then
echo $addressValuePair >> $stellarParticipantsOnline
- logit "INFO" "$p is configured with $(echo $addressValuePair | awk '{ print $2 }'). Added to online participants."
+ _ak_log_info "$p is configured with $(echo $addressValuePair | awk '{ print $2 }'). Added to online participants."
else
- logit "INFO" "$(echo $addressValuePair | awk '{ print $2 }') is already in $stellarParticipantsOnline. Skipping..."
+ _ak_log_info "$(echo $addressValuePair | awk '{ print $2 }') is already in $stellarParticipantsOnline. Skipping..."
fi
fi
done < $stellarParticipants
diff --git a/bin/ak-tempassin b/bin/ak-tempassin
index 20d1810..6831dc2 100755
--- a/bin/ak-tempassin
+++ b/bin/ak-tempassin
@@ -5,10 +5,10 @@ source $AK_LIBDIR/_ak_log
if [ ! -d "$AK_TEMP" ]
then
- logit "ERROR" "Could not make $AK_TEMP directory to work in"
+ _ak_log_error "Could not make $AK_TEMP directory to work in"
echo "Could not make $AK_TEMP directory to work in"
exit 1
fi
-logit "INFO" "$AK_TEMP created successfully"
+_ak_log_info "$AK_TEMP created successfully"
echo "$AK_TEMP"
diff --git a/bin/ak-transactions b/bin/ak-transactions
index f3bbf79..b23920a 100755
--- a/bin/ak-transactions
+++ b/bin/ak-transactions
@@ -13,7 +13,7 @@ source $AK_LIBDIR/_ak_gpg
source $AK_LIBDIR/_ak_zblock
_ak_modules_transactions_main(){
- logit "INFO" "$FROM_ADDRESS to $TO_ADDRESS value sent: $AMOUNT"
+ _ak_log_info "$FROM_ADDRESS to $TO_ADDRESS value sent: $AMOUNT"
cat > transaction_file <<EOF
$FROM_ADDRESS
$TO_ADDRESS
diff --git a/bin/ak-unfollow b/bin/ak-unfollow
index da22809..c23aeef 100755
--- a/bin/ak-unfollow
+++ b/bin/ak-unfollow
@@ -10,13 +10,13 @@ then
sed -i -e 's,'"$search"',,g' $FOLLOWING
if [ $? != 0 ]
then
- logit "ERROR" "sed didn't found $search"
+ _ak_log_error "sed didn't found $search"
exit 1
fi
IPFS="$(_ak_ipfs_add $FOLLOWING)"
if [ $? != 0 ]
then
- logit "ERROR" "IPFS problem"
+ _ak_log_error "IPFS problem"
exit 1
fi
ak-profile set repositories "$IPFS"
diff --git a/bin/ak-zchain-chk b/bin/ak-zchain-chk
index 16e60e2..89a834f 100755
--- a/bin/ak-zchain-chk
+++ b/bin/ak-zchain-chk
@@ -73,36 +73,36 @@ do
# Reset timestamp since it's introduced later
timestamp=''
# Announce to stdout which ZBLOCK is being read at the moment
- logit "INFO" "Examining $zblock"
+ _ak_log_info "Examining $zblock"
# We create files named after each ZBLOCK IPFS CID for later
# reference. Files are empty.
touch $AK_ZBLOCKDIR/$zblock
- logit "INFO" "Created reference"
+ _ak_log_info "Created reference"
# We concatenate the zblock's contents, pipe them through filter
# ak-json2bash and output them to tmp-file
_ak_ipfs_cat $zblock | ak-json2bash > tmp-zblock
- logit "INFO" "ZBLOCK $zblock READ"
+ _ak_log_info "ZBLOCK $zblock READ"
# Supposingly you are on a safe environment and you only have
# access to your chain, I would consider mild secure to source
# the files into your bash.
# File an issue/pull request if you think it can be done better!!
source tmp-zblock
- logit "INFO" "ZBLOCK SOURCED"
+ _ak_log_info "ZBLOCK SOURCED"
# Same as above applies to BLOCK and DATA subparts of each ZBLOCK
# BLOCKS
_ak_ipfs_cat $block | ak-json2bash > tmp-block
source tmp-block
- logit "INFO" "BLOCK $block SOURCED"
+ _ak_log_info "BLOCK $block SOURCED"
touch $AK_BLOCKDIR/$block
- logit "INFO" "BLOCK REFERENCED"
+ _ak_log_info "BLOCK REFERENCED"
module="$(echo $action | sed -e 's/\// /g' | awk '{ print $1 }')"
- logit "INFO" "DATA is $module module."
+ _ak_log_info "DATA is $module module."
command="$(echo $action | sed -e 's/\// /g' | awk '{ print $2 }')"
- logit "INFO" "COMMAND is $command"
+ _ak_log_info "COMMAND is $command"
if [ ! -v $timestamp ]
then
echo "$timestamp : $zblock -> $block -> $previous"
@@ -115,7 +115,7 @@ do
# code 0
if [ -v $previous ]
then
- logit "ERROR" "Block $block has no previous zblock"
+ _ak_log_error "Block $block has no previous zblock"
echo "Chain with no genesis"
if [ "$fix" == "1" ]
then
@@ -138,12 +138,12 @@ do
elif [ "$zblock" == "$seed" ]
then
echo "Chain is OK with GENESIS block = $seed"
- logit "INFO" "Counter $counter"
+ _ak_log_info "Counter $counter"
exit 0
fi
# And finally, if nothing is there exit with error
else
- logit "ERROR" "Check not passed... No previous IPFS CID"
+ _ak_log_error "Check not passed... No previous IPFS CID"
exit 1
fi
done
diff --git a/install.sh b/install.sh
index f4a596d..062a3ce 100755
--- a/install.sh
+++ b/install.sh
@@ -34,50 +34,25 @@ packageManager=""
installCommand=""
dontAskFlag=""
checkPkgManager(){
- printf "Searching for package manager..."
- which dnf 2> /dev/null 1>&2
- if [ $? == 0 ]
- then
- printf "\tFound DNF\n"
- packageManager="$(which dnf)"
- installCommand="install"
- dontAskFlag="-y"
- fi
- which apt 2> /dev/null 1>&2
- if [ $? == 0 ]
- then
- printf "\tFound APT\n"
- packageManager="$(which apt)"
- installCommand="install"
- dontAskFlag="-y"
- fi
- which zypper 2> /dev/null 1>&2
- if [ $? == 0 ]
- then
- printf "\tFound ZYPPER\n"
- packageManager="$(which zypper)"
- installCommand="install"
- dontAskFlag="-y"
- fi
- which pacman 2> /dev/null 1>&2
- if [ $? == 0 ]
- then
- printf "\tFound PACMAN\n"
- packageManager="$(which pacman)"
- installCommand="-S"
- dontAskFlag="--noconfirm"
- fi
- which apk 2> /dev/null 1>&2
- if [ $? == 0 ]
- then
- printf "\tFound APK\n"
- packageManager="$(which apk)"
- installCommand="add"
- dontAskFlag="-q"
- fi
+ declare -a pkgmanagers=("dnf" "apt" "zypper" "pacman" "apk")