Publish to web directory
This commit is contained in:
parent
f29191d71f
commit
dfccc08009
|
@ -41,8 +41,7 @@ PELICAN_PLUGINS_REPO="https://github.com/getpelican/pelican-plugins"
|
||||||
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
|
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
|
||||||
|
|
||||||
PELICAN_BLOG_INSTALL_DIR=/etc/blog
|
PELICAN_BLOG_INSTALL_DIR=/etc/blog
|
||||||
CURRENT_BLOG_INDEX=$PELICAN_BLOG_INSTALL_DIR/.blog-index
|
PELICAN_CURRENT_BLOG_INDEX=$PELICAN_BLOG_INSTALL_DIR/.blog-index
|
||||||
PELICAN_PELICAN_BLOG_INSTALL_DIR=/var/www/$PELICAN_BLOG_DOMAIN/htdocs
|
|
||||||
|
|
||||||
pelican_variables=(MY_USERNAME
|
pelican_variables=(MY_USERNAME
|
||||||
ONION_ONLY
|
ONION_ONLY
|
||||||
|
@ -77,6 +76,8 @@ function pelican_regenerate_blog {
|
||||||
|
|
||||||
cd $PELICAN_BLOG_INSTALL_DIR
|
cd $PELICAN_BLOG_INSTALL_DIR
|
||||||
make html
|
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 {
|
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
|
if grep -q $"Blog Post Title" $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ! -f $CURRENT_BLOG_INDEX ]; then
|
if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
|
||||||
echo '0' > $CURRENT_BLOG_INDEX
|
echo '0' > $PELICAN_CURRENT_BLOG_INDEX
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# move to the content directory
|
# 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
|
mv $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry $BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.md
|
||||||
|
|
||||||
# increment the index
|
# increment the index
|
||||||
CURRENT_INDEX=$((CURRENT_INDEX + 1))
|
CURRENT_INDEX=$((CURRENT_INDEX + 1))
|
||||||
echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX
|
echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX
|
||||||
|
|
||||||
pelican_regenerate_blog
|
pelican_regenerate_blog
|
||||||
}
|
}
|
||||||
|
|
||||||
function pelican_edit_blog {
|
function pelican_edit_blog {
|
||||||
if [ ! -f $CURRENT_BLOG_INDEX ]; then
|
if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX)
|
CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX)
|
||||||
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
|
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
|
||||||
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
|
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
|
||||||
if [ ! -f $LAST_BLOG_ENTRY ]; then
|
if [ ! -f $LAST_BLOG_ENTRY ]; then
|
||||||
|
@ -146,10 +147,10 @@ function pelican_edit_blog {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pelican_delete_blog {
|
function pelican_delete_blog {
|
||||||
if [ ! -f $CURRENT_BLOG_INDEX ]; then
|
if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX)
|
CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX)
|
||||||
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
|
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
|
||||||
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
|
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
|
||||||
if [ ! -f $LAST_BLOG_ENTRY ]; then
|
if [ ! -f $LAST_BLOG_ENTRY ]; then
|
||||||
|
@ -165,9 +166,9 @@ function pelican_delete_blog {
|
||||||
0) rm $LAST_BLOG_ENTRY
|
0) rm $LAST_BLOG_ENTRY
|
||||||
if [ $CURRENT_INDEX -gt 0 ]; then
|
if [ $CURRENT_INDEX -gt 0 ]; then
|
||||||
CURRENT_INDEX=$PREVIOUS_INDEX
|
CURRENT_INDEX=$PREVIOUS_INDEX
|
||||||
echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX
|
echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX
|
||||||
else
|
else
|
||||||
rm -f $CURRENT_BLOG_INDEX
|
rm -f $PELICAN_CURRENT_BLOG_INDEX
|
||||||
fi
|
fi
|
||||||
pelican_regenerate_blog
|
pelican_regenerate_blog
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue