Publish to ipfs after mesh blog changes
This commit is contained in:
parent
2cb7b2aa74
commit
63ba1c993a
|
@ -31,22 +31,41 @@ PROJECT_NAME='freedombone'
|
|||
export TEXTDOMAIN=${PROJECT_NAME}-mesh-blog
|
||||
export TEXTDOMAINDIR="/usr/share/locale"
|
||||
|
||||
IPFS_PATH=/usr/bin
|
||||
IPFS_COMMAND=$IPFS_PATH/ipfs
|
||||
IPFS_PUBLIC=/home/$USER/.ipfs-public
|
||||
|
||||
BLOG_PATH=~/CreateBlog
|
||||
BLOG_CONTENT_PATH=$BLOG_PATH/content
|
||||
CURRENT_BLOG_INDEX=/home/$USER/.blog-index
|
||||
BLOG_EDITOR='pluma'
|
||||
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
|
||||
|
||||
function ipfs_publish {
|
||||
DIR_TO_CHECK=/home/$USER/Public
|
||||
if [ ! -d $DIR_TO_CHECK ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo ''
|
||||
echo $'Publishing to IPFS...'
|
||||
|
||||
OLD_STAT_FILE=/home/$MY_USERNAME/.old_stat.txt
|
||||
NEW_STAT=$(stat -t $DIR_TO_CHECK)
|
||||
echo $($IPFS_COMMAND add -rq /home/$USER/Public | tail -n 1) > $IPFS_PUBLIC
|
||||
echo "$NEW_STAT" > $OLD_STAT_FILE
|
||||
|
||||
if [ -f $IPFS_PUBLIC ]; then
|
||||
IPFS_PUBLIC_ID=$(cat $IPFS_PUBLIC)
|
||||
$IPFS_COMMAND name publish /ipfs/$IPFS_PUBLIC_ID
|
||||
fi
|
||||
}
|
||||
|
||||
function regenerate_blog {
|
||||
clear
|
||||
echo ''
|
||||
echo $'Regenerating blog...'
|
||||
|
||||
OLD_STAT_FILE=/home/$USER/.old_stat.txt
|
||||
if [ -f $OLD_STAT_FILE ]; then
|
||||
rm -f $OLD_STAT_FILE
|
||||
fi
|
||||
|
||||
cd $BLOG_PATH
|
||||
if grep -q "SITENAME=u'${DEFAULT_BLOG_TITLE}'" $BLOG_PATH/pelicanconf.py; then
|
||||
TOX_NICK=$(toxid --showuser)
|
||||
|
@ -54,6 +73,7 @@ function regenerate_blog {
|
|||
sed -i "s|SITENAME=.*|SITENAME=u\"${BLOG_TITLE}\"|g" $BLOG_PATH/pelicanconf.py
|
||||
fi
|
||||
make html
|
||||
ipfs_publish
|
||||
}
|
||||
|
||||
function view_blog {
|
||||
|
|
Loading…
Reference in New Issue