aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-03-11 19:36:28 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-03-11 19:36:28 +0200
commitbf87d94330c6c6153eab9f1a3016efeef5ebc754 (patch)
tree99ca0366d4d956848d8793130734e5761794dade /bin
parentd4e498a18f700e288764cdf8799a2b07a76e1615 (diff)
downloadarching-kaos-tools-bf87d94330c6c6153eab9f1a3016efeef5ebc754.tar.gz
arching-kaos-tools-bf87d94330c6c6153eab9f1a3016efeef5ebc754.tar.bz2
arching-kaos-tools-bf87d94330c6c6153eab9f1a3016efeef5ebc754.zip
Introduced ./lib for common stuff
ofc, logit was the first lib to add... finally
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak5
-rwxr-xr-xbin/ak-articles5
-rwxr-xr-xbin/ak-comments5
-rwxr-xr-xbin/ak-data-expand6
-rwxr-xr-xbin/ak-enter5
-rwxr-xr-xbin/ak-files5
-rwxr-xr-xbin/ak-find-latest-mined-sblock5
-rwxr-xr-xbin/ak-folders4
-rwxr-xr-xbin/ak-follow5
-rwxr-xr-xbin/ak-following5
-rwxr-xr-xbin/ak-fs-add4
-rwxr-xr-xbin/ak-ipfs-check4
-rwxr-xr-xbin/ak-ipns-resolve5
-rwxr-xr-xbin/ak-news12
-rwxr-xr-xbin/ak-profile4
-rwxr-xr-xbin/ak-sm-files5
-rwxr-xr-xbin/ak-sm-filesplitter4
-rwxr-xr-xbin/ak-stellar-get-participants5
-rwxr-xr-xbin/ak-tempassin5
-rwxr-xr-xbin/ak-todos5
-rwxr-xr-xbin/ak-transactions4
-rwxr-xr-xbin/ak-zblock-cache4
-rwxr-xr-xbin/ak-zblock-manipulator4
-rwxr-xr-xbin/ak-zblock-pack4
-rwxr-xr-xbin/ak-zblock-show4
-rwxr-xr-xbin/ak-zchain-chk5
26 files changed, 43 insertions, 85 deletions
diff --git a/bin/ak b/bin/ak
index ce8fb14..367a293 100755
--- a/bin/ak
+++ b/bin/ak
@@ -1,10 +1,7 @@
#!/bin/bash
PROGRAM=$(basename $0)
-
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
if [ $# -eq 0 ]
then
diff --git a/bin/ak-articles b/bin/ak-articles
index 22222cb..248f425 100755
--- a/bin/ak-articles
+++ b/bin/ak-articles
@@ -3,9 +3,8 @@
PROGRAM=$(basename $0)
descriptionString="Articles module for Arching Kaos"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
new_line(){
printf '\n'
}
diff --git a/bin/ak-comments b/bin/ak-comments
index 0d65273..590df45 100755
--- a/bin/ak-comments
+++ b/bin/ak-comments
@@ -1,8 +1,7 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
ZCOMMENTSDIR="$AK_WORKDIR/comments"
TEMP="/tmp/aktmp"
if [ ! -d $ZCOMMENTSDIR ]; then
diff --git a/bin/ak-data-expand b/bin/ak-data-expand
index d13233d..3e194a3 100755
--- a/bin/ak-data-expand
+++ b/bin/ak-data-expand
@@ -1,12 +1,12 @@
#!/bin/bash
PROGRAM="$(basename $0)"
+source $AK_LIBDIR/logit
+
if [ ! -d $AK_WORKDIR/ipfs ]
then
mkdir $AK_WORKDIR/ipfs
fi
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+
if [ ! -z "$1" ] && [ ! -z "$2" ]
then
echo -n "$1" | grep -e 'Qm.\{44\}' >/dev/null
diff --git a/bin/ak-enter b/bin/ak-enter
index b67622a..a28914d 100755
--- a/bin/ak-enter
+++ b/bin/ak-enter
@@ -18,10 +18,7 @@
# Logs messages to $LOGSFILE.
PROGRAM="$(basename $0)"
-
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
usage(){
echo "$PROGRAM - Crawl an arching kaos chain"
diff --git a/bin/ak-files b/bin/ak-files
index 299bf4a..626bc2b 100755
--- a/bin/ak-files
+++ b/bin/ak-files
@@ -3,9 +3,8 @@
ZFILESDIR="$AK_WORKDIR/files"
TEMP="/tmp/aktmp"
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
if [ ! -d $ZFILESDIR ]; then
mkdir $ZFILESDIR
if [ $? == 0 ]
diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock
index 73bc67a..ca435de 100755
--- a/bin/ak-find-latest-mined-sblock
+++ b/bin/ak-find-latest-mined-sblock
@@ -3,9 +3,8 @@ MINED_BLOCKS_DIR="/home/$USER/.arching-kaos/mined_blocks"
cd $MINED_BLOCKS_DIR
PROGRAM="$(basename $0)"
declare -A counters
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
further(){
# logit "INFO" "Diving into $1"
lookfor $1
diff --git a/bin/ak-folders b/bin/ak-folders
index 7116263..23fe0b9 100755
--- a/bin/ak-folders
+++ b/bin/ak-folders
@@ -4,9 +4,7 @@ PROGRAM="$(basename $0)"
ZFOLDERSDIR="$AK_WORKDIR/folders"
TEMP="/tmp/aktmp"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
if [ ! -d $ZFOLDERSDIR ]; then
mkdir $ZFOLDERSDIR
diff --git a/bin/ak-follow b/bin/ak-follow
index a4ca070..0e6529c 100755
--- a/bin/ak-follow
+++ b/bin/ak-follow
@@ -1,9 +1,8 @@
#!/bin/bash
FOLLOWING="$HOME/.arching-kaos/following"
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
if [ ! -z $1 ]
then
grep $1 $FOLLOWING
diff --git a/bin/ak-following b/bin/ak-following
index deb631d..dc21aa4 100755
--- a/bin/ak-following
+++ b/bin/ak-following
@@ -1,8 +1,7 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
FOLLOWING="$HOME/.arching-kaos/following"
if [ -f $FOLLOWING ]
then
diff --git a/bin/ak-fs-add b/bin/ak-fs-add
index 2ba5e91..1c05b03 100755
--- a/bin/ak-fs-add
+++ b/bin/ak-fs-add
@@ -47,9 +47,7 @@ TECHDIR="$TEMPORARYDIR/chks/"
CURRENTDIR="$(pwd)/"
# Our snippet for logging debug info
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
# Checking directories and create them if necessary
rm -rf $TEMPORARYDIR
diff --git a/bin/ak-ipfs-check b/bin/ak-ipfs-check
index e2c3955..c089ee7 100755
--- a/bin/ak-ipfs-check
+++ b/bin/ak-ipfs-check
@@ -1,8 +1,6 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
ak-ipfs-files-ls /zarchive > /dev/null
if [ $? != 0 ]
diff --git a/bin/ak-ipns-resolve b/bin/ak-ipns-resolve
index c01e822..7f3839c 100755
--- a/bin/ak-ipns-resolve
+++ b/bin/ak-ipns-resolve
@@ -8,9 +8,8 @@ usage(){
echo ""
echo "Returns the resolved IPFS CIDv0"
}
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
if [ ! -z $1 ]
then
rsld=$(ak-ipfs-name-resolve $1)
diff --git a/bin/ak-news b/bin/ak-news
index 2a787dc..fe7a003 100755
--- a/bin/ak-news
+++ b/bin/ak-news
@@ -5,18 +5,15 @@ descriptionString="Module to read, create and add zblocks"
ZNEWSDIR="$AK_WORKDIR/news"
TEMP="/tmp/aktmp"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
if [ ! -d $ZNEWSDIR ]; then
mkdir $ZNEWSDIR
- if [ "$?" == 0 ]; then
- logit "INFO" "$ZNEWSDIR created"
- else
+ if [ $? -ne 0 ]; then
logit "ERROR" "$ZNEWSDIR couldn't be created"
exit 1
fi
+ logit "INFO" "$ZNEWSDIR created"
else
logit "INFO" "$ZNEWSDIR found"
fi
@@ -35,9 +32,8 @@ _ak_modules_news_create(){
TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
IPFS_FILE=$(ak-ipfs-add $NEWS_FILE)
mv $NEWS_FILE $ZNEWSDIR/$TO_FILE
- sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZNEWSDIR/README
+ sed -i -e 's,Qm.*,'"$IPFS_FILE"',g' $ZNEWSDIR/README
_ak_modules_news_add $TO_FILE
- echo "Adding to git repo..."
cd $ZNEWSDIR
# rm -rf $TEMP
}
diff --git a/bin/ak-profile b/bin/ak-profile
index 84ead70..7499b88 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -4,9 +4,7 @@ ZPROFILEDIR="$AK_WORKDIR/profile"
TEMP="/tmp/aktmp"
# Outputs to log file in the classic format :)
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
# Whatever the command is, we check if $ZPROFILEDIR is there.
# If NOT we create it and we change dir there.
diff --git a/bin/ak-sm-files b/bin/ak-sm-files
index 14a3a05..e4815d0 100755
--- a/bin/ak-sm-files
+++ b/bin/ak-sm-files
@@ -5,9 +5,8 @@ CRD=$(cat .pwd)
PROGRAM="$(basename $0)"
#set -xe
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
if [ ! -d $ZFILESDIR ]; then
mkdir $ZFILESDIR
if [ $? == 0 ]
diff --git a/bin/ak-sm-filesplitter b/bin/ak-sm-filesplitter
index d77b8ae..e121f32 100755
--- a/bin/ak-sm-filesplitter
+++ b/bin/ak-sm-filesplitter
@@ -41,9 +41,7 @@ TECHDIR="/tmp/tltmp/chks/"
CURRENTDIR="$(pwd)/"
# Our snippet for logging debug info
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
# Checking directories and create them if necessary
diff --git a/bin/ak-stellar-get-participants b/bin/ak-stellar-get-participants
index 82c5503..11ea008 100755
--- a/bin/ak-stellar-get-participants
+++ b/bin/ak-stellar-get-participants
@@ -3,9 +3,8 @@ PROGRAM="$(basename $0)"
tempdir=`mktemp -d`
tempfile="$tempdir/tmp"
tempaddr="$tempdir/tmpaddr"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
stellarParticipants="$AK_WORKDIR/stellar-network-participants"
stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online"
if [ ! -f "$stellarParticipants" ]
diff --git a/bin/ak-tempassin b/bin/ak-tempassin
index 575e55e..f2ac20c 100755
--- a/bin/ak-tempassin
+++ b/bin/ak-tempassin
@@ -1,9 +1,8 @@
#!/bin/bash
AK_TEMP="$(mktemp -d /tmp/aktmp-XXXXXXX)"
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
if [ ! -d "$AK_TEMP" ]
then
logit "ERROR" "Could not make $AK_TEMP directory to work in"
diff --git a/bin/ak-todos b/bin/ak-todos
index 621fe61..8686836 100755
--- a/bin/ak-todos
+++ b/bin/ak-todos
@@ -1,8 +1,7 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
ZTODOSDIR="$AK_WORKDIR/todos"
TEMP="/tmp/aktmp"
if [ ! -d $ZTODOSDIR ]; then
diff --git a/bin/ak-transactions b/bin/ak-transactions
index 92a622f..ec48853 100755
--- a/bin/ak-transactions
+++ b/bin/ak-transactions
@@ -4,9 +4,7 @@ _ak_modules_transactions_usage(){
echo "$PROGRAM from to amount"
}
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
_ak_modules_transactions_main(){
logit "INFO" "$FROM_ADDRESS to $TO_ADDRESS value sent: $AMOUNT"
diff --git a/bin/ak-zblock-cache b/bin/ak-zblock-cache
index ca4f736..ed25f23 100755
--- a/bin/ak-zblock-cache
+++ b/bin/ak-zblock-cache
@@ -1,8 +1,6 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
if [ ! -d "$AK_CACHEDIR/fzblocks" ]
then
diff --git a/bin/ak-zblock-manipulator b/bin/ak-zblock-manipulator
index ab78053..8f83137 100755
--- a/bin/ak-zblock-manipulator
+++ b/bin/ak-zblock-manipulator
@@ -16,9 +16,7 @@
# Below, the usage information
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
usage(){
echo "Usage:"
diff --git a/bin/ak-zblock-pack b/bin/ak-zblock-pack
index 6c4b8d4..9dd8c53 100755
--- a/bin/ak-zblock-pack
+++ b/bin/ak-zblock-pack
@@ -18,9 +18,7 @@ PROGRAM="$(basename $0)"
set -xe
# Logging patch
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
# Below, the usage information
usage(){
diff --git a/bin/ak-zblock-show b/bin/ak-zblock-show
index d0ebcc5..b828726 100755
--- a/bin/ak-zblock-show
+++ b/bin/ak-zblock-show
@@ -7,9 +7,7 @@
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
usage(){
echo "$PROGRAM - Show a zblock"
diff --git a/bin/ak-zchain-chk b/bin/ak-zchain-chk
index 6b75405..f6cdd11 100755
--- a/bin/ak-zchain-chk
+++ b/bin/ak-zchain-chk
@@ -1,8 +1,7 @@
#!/bin/bash
PROGRAM="$(basename $0)"
-logit(){
- ak-logthis "$PROGRAM" "$1" "$2"
-}
+source $AK_LIBDIR/logit
+
fix="0"
usage(){
echo "zchain-chk - Check and fix zchain"