aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rwxr-xr-xconfig.sh1
-rwxr-xr-xinit.sh23
-rwxr-xr-xinstall.sh1
-rwxr-xr-xlib/logit5
-rwxr-xr-xupdate.sh19
31 files changed, 90 insertions, 87 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"
diff --git a/config.sh b/config.sh
index 3691fc5..c122584 100755
--- a/config.sh
+++ b/config.sh
@@ -3,6 +3,7 @@ export AK_ROOT=$HOME
export AK_WORKDIR="$AK_ROOT/.arching-kaos"
export AK_CONFIGDIR="$AK_WORKDIR/config"
export AK_BINDIR="$AK_WORKDIR/bin"
+export AK_LIBDIR="$AK_WORKDIR/lib"
export AK_ZBLOCKDIR="$AK_WORKDIR/zblocks"
export AK_BLOCKDIR="$AK_WORKDIR/blocks"
export AK_DATADIR="$AK_WORKDIR/data"
diff --git a/init.sh b/init.sh
index d278039..c4c92c0 100755
--- a/init.sh
+++ b/init.sh
@@ -86,7 +86,7 @@ do
then
printf "Creating symlink to %s..." "$b"
ln -s $(pwd)/bin/$b $AK_BINDIR/$b
- if [ "$?" -ne "0" ]
+ if [ $? -ne 0 ]
then
if [ -L $AK_BINDIR/$b ]
then
@@ -99,3 +99,24 @@ do
printf "\tOK!\n"
fi
done
+# Find libs and create symlinks
+libfiles=$(ls -1 $(pwd)/lib)
+for b in $libfiles
+do
+ if [ ! -L $AK_LIBDIR/$b ]
+ then
+ printf "Creating symlink to %s..." "$b"
+ ln -s $(pwd)/lib/$b $AK_LIBDIR/$b
+ if [ $? -ne 0 ]
+ then
+ if [ -L $AK_LIBDIR/$b ]
+ then
+ printf "\tAlready exists!\n"
+ exit 1
+ fi
+ printf "\tFailed!\n"
+ exit 1
+ fi
+ printf "\tOK!\n"
+ fi
+done
diff --git a/install.sh b/install.sh
index f2d725d..72aaa27 100755
--- a/install.sh
+++ b/install.sh
@@ -146,6 +146,7 @@ fi
if [ ! -d $AK_CONFIGDIR ] ; then mkdir $AK_CONFIGDIR ;fi
if [ ! -d $AK_BINDIR ]; then mkdir $AK_BINDIR ;fi
+if [ ! -d $AK_LIBDIR ]; then mkdir $AK_LIBDIR ;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
diff --git a/lib/logit b/lib/logit
new file mode 100755
index 0000000..c6e1b51
--- /dev/null
+++ b/lib/logit
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+logit(){
+ ak-logthis "$PROGRAM" "$1" "$2"
+}
diff --git a/update.sh b/update.sh
index bfa66f2..cd2aeaf 100755
--- a/update.sh
+++ b/update.sh
@@ -1,5 +1,6 @@
#!/bin/bash
+# Updates bin files
find $AK_BINDIR -type l | while read link
do
if [ ! -f $link ]
@@ -9,9 +10,25 @@ do
fi
done
-# Find scripts and create symlinks
binfiles=$(ls -1 $(pwd)/bin)
for b in $binfiles
do
if [ ! -L $AK_BINDIR/$b ] ; then ln -s $(pwd)/bin/$b $AK_BINDIR/$b ;fi
done
+
+# Updates lib files
+find $AK_LIBDIR -type l | while read link
+do
+ if [ ! -f $link ]
+ then
+ echo "Non working link: $(basename $link) removing..."
+ rm $link
+ fi
+done
+
+# Find scripts and create symlinks
+libfiles=$(ls -1 $(pwd)/lib)
+for l in $libfiles
+do
+ if [ ! -L $AK_LIBDIR/$l ] ; then ln -s $(pwd)/lib/$l $AK_LIBDIR/$l ;fi
+done