From bf87d94330c6c6153eab9f1a3016efeef5ebc754 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 11 Mar 2024 19:36:28 +0200 Subject: Introduced ./lib for common stuff ofc, logit was the first lib to add... finally --- bin/ak-news | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'bin/ak-news') 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 } -- cgit v1.2.3