diff --git a/src/freedombone-app-pelican b/src/freedombone-app-pelican index 7b2b894e..eee6dd5a 100755 --- a/src/freedombone-app-pelican +++ b/src/freedombone-app-pelican @@ -41,8 +41,7 @@ PELICAN_PLUGINS_REPO="https://github.com/getpelican/pelican-plugins" DEFAULT_BLOG_TITLE=$"Freedombone Blog" PELICAN_BLOG_INSTALL_DIR=/etc/blog -CURRENT_BLOG_INDEX=$PELICAN_BLOG_INSTALL_DIR/.blog-index -PELICAN_PELICAN_BLOG_INSTALL_DIR=/var/www/$PELICAN_BLOG_DOMAIN/htdocs +PELICAN_CURRENT_BLOG_INDEX=$PELICAN_BLOG_INSTALL_DIR/.blog-index pelican_variables=(MY_USERNAME ONION_ONLY @@ -77,6 +76,8 @@ function pelican_regenerate_blog { cd $PELICAN_BLOG_INSTALL_DIR make html + cp -r $PELICAN_BLOG_INSTALL_DIR/output/* /var/www/$PELICAN_BLOG_DOMAIN/htdocs/ + chown -R www-data:www-data /var/www/$PELICAN_BLOG_DOMAIN/htdocs } function pelican_new_blog { @@ -110,26 +111,26 @@ function pelican_new_blog { if grep -q $"Blog Post Title" $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry; then return fi - if [ ! -f $CURRENT_BLOG_INDEX ]; then - echo '0' > $CURRENT_BLOG_INDEX + if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then + echo '0' > $PELICAN_CURRENT_BLOG_INDEX fi # move to the content directory - CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX) + CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX) mv $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry $BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.md # increment the index CURRENT_INDEX=$((CURRENT_INDEX + 1)) - echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX + echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX pelican_regenerate_blog } function pelican_edit_blog { - if [ ! -f $CURRENT_BLOG_INDEX ]; then + if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then return fi - CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX) + CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX) PREVIOUS_INDEX=$((CURRENT_INDEX - 1)) LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md if [ ! -f $LAST_BLOG_ENTRY ]; then @@ -146,10 +147,10 @@ function pelican_edit_blog { } function pelican_delete_blog { - if [ ! -f $CURRENT_BLOG_INDEX ]; then + if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then return fi - CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX) + CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX) PREVIOUS_INDEX=$((CURRENT_INDEX - 1)) LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md if [ ! -f $LAST_BLOG_ENTRY ]; then @@ -165,9 +166,9 @@ function pelican_delete_blog { 0) rm $LAST_BLOG_ENTRY if [ $CURRENT_INDEX -gt 0 ]; then CURRENT_INDEX=$PREVIOUS_INDEX - echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX + echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX else - rm -f $CURRENT_BLOG_INDEX + rm -f $PELICAN_CURRENT_BLOG_INDEX fi pelican_regenerate_blog ;;