freedombonee/src/freedombone-app-pelican

488 lines
20 KiB
Plaintext
Raw Normal View History

2016-09-07 21:44:32 +02:00
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Static blog
#
# License
# =======
#
2016-10-31 17:24:49 +01:00
# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
2016-09-07 21:44:32 +02:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2016-09-30 11:06:30 +02:00
VARIANTS=''
2016-09-07 21:44:32 +02:00
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=0
2017-03-25 19:07:31 +01:00
PELICAN_BLOG_DOMAIN=
PELICAN_BLOG_CODE=
2016-09-07 21:44:32 +02:00
STATIC_BLOG_INSTALL_DIR=/etc/staticblog
PELICAN_THEMES_REPO="https://github.com/getpelican/pelican-themes"
PELICAN_PLUGINS_REPO="https://github.com/getpelican/pelican-plugins"
2016-09-09 10:31:27 +02:00
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
2016-09-07 21:44:32 +02:00
2016-10-16 13:51:04 +02:00
pelican_variables=(MY_USERNAME
2017-03-25 19:07:31 +01:00
ONION_ONLY
PELICAN_BLOG_DOMAIN
PELICAN_BLOG_CODE)
2016-10-05 23:33:41 +02:00
2016-10-16 13:51:04 +02:00
function configure_interactive_pelican {
echo -n ''
}
2016-10-16 13:51:04 +02:00
function install_interactive_pelican {
2017-03-25 19:07:31 +01:00
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if [[ $ONION_ONLY != "no" ]]; then
PELICAN_BLOG_DOMAIN='pelican.local'
else
PELICAN_DETAILS_COMPLETE=
while [ ! $PELICAN_DETAILS_COMPLETE ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Pelican Blog Configuration" \
--form $"\nPlease enter your blog details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
$"Domain:" 1 1 "$(grep 'PELICAN_BLOG_DOMAIN' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
$"Code:" 2 1 "$(grep 'PELICAN_BLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 25 33 255 \
2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"Pelican Blog Configuration" \
--form $"\nPlease enter your GNU Social details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
$"Domain:" 1 1 "$(grep 'PELICAN_BLOG_DOMAIN' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
PELICAN_BLOG_DOMAIN=$(cat $data | sed -n 1p)
if [ $PELICAN_BLOG_DOMAIN ]; then
if [[ $PELICAN_BLOG_DOMAIN == "$HUBZILLA_DOMAIN_NAME" ]]; then
PELICAN_BLOG_DOMAIN=""
fi
TEST_DOMAIN_NAME=$PELICAN_BLOG_DOMAIN
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $PELICAN_BLOG_DOMAIN ]]; then
PELICAN_BLOG_DOMAIN=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
PELICAN_BLOG_CODE=$(cat $data | sed -n 2p)
validate_freedns_code "$PELICAN_BLOG_CODE"
if [ ! $VALID_CODE ]; then
PELICAN_BLOG_DOMAIN=
fi
fi
fi
fi
if [ $PELICAN_BLOG_DOMAIN ]; then
PELICAN_DETAILS_COMPLETE="yes"
fi
done
# save the results in the config file
write_config_param "PELICAN_BLOG_CODE" "$PELICAN_BLOG_CODE"
fi
write_config_param "PELICAN_BLOG_DOMAIN" "$PELICAN_BLOG_DOMAIN"
APP_INSTALLED=1
}
2016-10-16 13:51:04 +02:00
function reconfigure_pelican {
2016-09-07 21:44:32 +02:00
echo -n ''
}
2016-10-16 13:51:04 +02:00
function upgrade_pelican {
2016-09-07 21:44:32 +02:00
echo -n ''
}
2016-10-16 13:51:04 +02:00
function backup_local_pelican {
2017-03-26 12:31:21 +02:00
source_directory=/etc/blog
if [ -d $source_directory ]; then
dest_directory=pelican
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
fi
source_directory=/var/www/$PELICAN_BLOG_DOMAIN/htdocs
if [ -d $source_directory ]; then
dest_directory=pelican-site
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
fi
2016-09-07 21:44:32 +02:00
}
2016-10-16 13:51:04 +02:00
function restore_local_pelican {
2017-03-26 12:31:21 +02:00
if [ -d /etc/blog ]; then
if [ -d $USB_MOUNT_DLNA/backup/pelican ]; then
temp_restore_dir=/root/temppelican
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir pelican
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit 527942
fi
rm -rf $temp_restore_dir
fi
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
if [ -d $USB_MOUNT_DLNA/backup/pelican-site ]; then
temp_restore_dir=/root/temppelican-site
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir pelican-site
cp -r $temp_restore_dir/var/www/$PELICAN_BLOG_DOMAIN/htdocs/* /var/www/$PELICAN_BLOG_DOMAIN/htdocs/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit 2946282
fi
rm -rf $temp_restore_dir
fi
fi
2016-09-07 21:44:32 +02:00
}
2016-10-16 13:51:04 +02:00
function backup_remote_pelican {
2017-03-26 12:31:21 +02:00
if [ -d /etc/blog ]; then
backup_directory_to_friend /etc/blog pelican
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
backup_directory_to_friend /var/www/$PELICAN_BLOG_DOMAIN/htdocs pelican-site
fi
2016-09-07 21:44:32 +02:00
}
2016-10-16 13:51:04 +02:00
function restore_remote_pelican {
2017-03-26 12:31:21 +02:00
if [ -d /etc/blog ]; then
if [ -d $SERVER_DIRECTORY/backup/pelican ]; then
temp_restore_dir=/root/temppelican
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir pelican
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
if [ ! "$?" = "0" ]; then
exit 782352
fi
rm -rf $temp_restore_dir
fi
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
if [ -d $SERVER_DIRECTORY/backup/pelican-site ]; then
temp_restore_dir=/root/temppelican-site
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir pelican-site
cp -r $temp_restore_dir/var/www/$PELICAN_BLOG_DOMAIN/htdocs/* /var/www/$PELICAN_BLOG_DOMAIN/htdocs/
if [ ! "$?" = "0" ]; then
exit 76382562
fi
rm -rf $temp_restore_dir
fi
fi
2016-09-23 21:36:10 +02:00
}
2016-10-16 13:51:04 +02:00
function remove_pelican {
2017-03-25 19:07:31 +01:00
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
rm -rf /var/www/$PELICAN_BLOG_DOMAIN/htdocs
2016-10-17 15:44:49 +02:00
fi
pip uninstall pelican
2017-03-25 19:07:31 +01:00
remove_certs $PELICAN_BLOG_DOMAIN
2016-09-07 21:44:32 +02:00
}
function create_pelican_conf {
STATIC_BLOG_FILE=$1
echo '#!/usr/bin/env python' > $STATIC_BLOG_FILE
echo '# -*- coding: utf-8 -*- #' >> $STATIC_BLOG_FILE
echo 'from __future__ import unicode_literals' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
2016-09-08 16:59:38 +02:00
echo "AUTHOR=u\"$MY_USERNAME\"" >> $STATIC_BLOG_FILE
2016-09-09 10:31:27 +02:00
echo "SITENAME=u'$DEFAULT_BLOG_TITLE'" >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo "SITEURL=''" >> $STATIC_BLOG_FILE
echo "PATH='content'" >> $STATIC_BLOG_FILE
2016-09-08 16:59:38 +02:00
echo 'TIMEZONE=u"Europe/London"' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo "DEFAULT_LANG=u'en'" >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
2016-09-08 17:31:16 +02:00
echo 'FEED_ALL_ATOM=None' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'CATEGORY_FEED_ATOM=None' >> $STATIC_BLOG_FILE
echo 'TRANSLATION_FEED_ATOM=None' >> $STATIC_BLOG_FILE
echo 'AUTHOR_FEED_ATOM=None' >> $STATIC_BLOG_FILE
echo 'AUTHOR_FEED_RSS=None' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'DEFAULT_PAGINATION=False' >> $STATIC_BLOG_FILE
echo 'RELATIVE_URLS=True' >> $STATIC_BLOG_FILE
2016-09-11 20:31:47 +02:00
echo "THEME='themes/nice-blog'" >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
}
function create_pelican_makefile {
STATIC_BLOG_FILE=$1
echo 'PY?=python' > $STATIC_BLOG_FILE
echo 'PELICAN?=pelican' >> $STATIC_BLOG_FILE
echo 'PELICANOPTS=' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'BASEDIR=$(CURDIR)' >> $STATIC_BLOG_FILE
echo 'INPUTDIR=$(BASEDIR)/content' >> $STATIC_BLOG_FILE
2016-09-08 17:31:16 +02:00
echo "OUTPUTDIR=$STATIC_BLOG_PATH" >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'CONFFILE=$(BASEDIR)/pelicanconf.py' >> $STATIC_BLOG_FILE
echo 'PUBLISHCONF=$(BASEDIR)/publishconf.py' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'DEBUG ?= 0' >> $STATIC_BLOG_FILE
echo 'ifeq ($(DEBUG), 1)' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tPELICANOPTS += -D' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'endif' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'RELATIVE ?= 0' >> $STATIC_BLOG_FILE
echo 'ifeq ($(RELATIVE), 1)' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tPELICANOPTS += --relative-urls' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'endif' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'html:' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo '' >> $STATIC_BLOG_FILE
echo 'clean:' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo '' >> $STATIC_BLOG_FILE
echo 'regenerate:' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo '' >> $STATIC_BLOG_FILE
echo 'serve:' >> $STATIC_BLOG_FILE
echo 'ifdef PORT' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'else' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'endif' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'serve-global:' >> $STATIC_BLOG_FILE
echo 'ifdef SERVER' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'else' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'endif' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'devserver:' >> $STATIC_BLOG_FILE
echo 'ifdef PORT' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(BASEDIR)/develop_server.sh restart $(PORT)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'else' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(BASEDIR)/develop_server.sh restart' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo 'endif' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'stopserver:' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(BASEDIR)/develop_server.sh stop' >> $STATIC_BLOG_FILE
echo -e '\t@echo "Stopped Pelican and SimpleHTTPServer processes running in background."' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo '' >> $STATIC_BLOG_FILE
echo 'publish:' >> $STATIC_BLOG_FILE
2016-09-08 16:51:11 +02:00
echo -e '\t$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
2016-09-07 21:44:32 +02:00
echo '' >> $STATIC_BLOG_FILE
echo '.PHONY: html clean regenerate serve serve-global devserver publish' >> $STATIC_BLOG_FILE
}
function create_pelican_publish_conf {
STATIC_BLOG_FILE=$1
echo '#!/usr/bin/env python' > $STATIC_BLOG_FILE
echo '# -*- coding: utf-8 -*- #' >> $STATIC_BLOG_FILE
echo 'from __future__ import unicode_literals' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'import os' >> $STATIC_BLOG_FILE
echo 'import sys' >> $STATIC_BLOG_FILE
echo 'sys.path.append(os.curdir)' >> $STATIC_BLOG_FILE
echo 'from pelicanconf import *' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo "SITEURL = ''" >> $STATIC_BLOG_FILE
echo 'RELATIVE_URLS = True' >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo "FEED_ALL_ATOM = 'feeds/all.atom.xml'" >> $STATIC_BLOG_FILE
echo "CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'" >> $STATIC_BLOG_FILE
echo '' >> $STATIC_BLOG_FILE
echo 'DELETE_OUTPUT_DIRECTORY = True' >> $STATIC_BLOG_FILE
}
2016-10-16 13:51:04 +02:00
function pelican_themes {
2016-09-10 19:43:08 +02:00
# Clone themes separately because the themes repo sometimes has bad refs
git clone https://github.com/KenMercusLai/BT3-Flat
git clone https://github.com/abr4xas/Casper2Pelican
git clone https://github.com/alexandrevicenzi/Flex
git clone https://github.com/allenskd/Nuja
git clone https://github.com/ir193/Responsive-Pelican
git clone https://github.com/nairobilug/pelican-alchemy
git clone https://github.com/livibetter-backup/apricot
git clone https://github.com/jody-frankowski/blue-penguin
git clone https://github.com/gregseth/pelican-bgh
git clone https://github.com/blueicefield/pelican-blueidea
git clone https://github.com/demianbrecht/pelican-bold
git clone https://github.com/fly/burrito
git clone https://github.com/yuex/pelican-iliork
git clone https://github.com/tbunnyman/pelican-chunk
git clone https://github.com/hdra/Pelican-Cid
git clone https://github.com/gilsondev/pelican-clean-blog
git clone https://github.com/porterjamesj/crowsfoot
git clone https://github.com/22decembre/dev-random3.git
git clone https://github.com/kura/eevee
git clone https://github.com/talha131/pelican-elegant.git
git clone https://github.com/callmefish/pelican-free-agent
git clone https://github.com/jsliang/pelican-fresh
git clone https://github.com/vaiski/genus
git clone https://github.com/PierrePaul/html5-dopetrope
git clone https://github.com/jvanz/pelican-hyde
git clone https://github.com/erfaan/pelican-theme-irfan
git clone https://github.com/slok/iris
git clone https://github.com/badele/pelican-theme-jesuislibre
git clone https://github.com/mothsART/pelican-lab
git clone https://github.com/siovene/lannisport
git clone https://github.com/lazycoder-ru/lazystrap
git clone https://github.com/chdoig/pelican-bootstrap3-lovers
git clone https://github.com/kplaube/maggner-pelican
git clone https://github.com/cpaulik/martin-pelican
git clone https://github.com/greizgh/pelican-material
git clone https://github.com/eswarm/materialistic-pelican
git clone https://github.com/cprieto/pelican-mediumfox
git clone https://github.com/onuraslan/medius
git clone https://github.com/lucachr/pelican-mg
git clone https://github.com/BYK/pelican-neat
git clone https://github.com/molivier/nest
git clone https://github.com/guilherme-toti/nice-blog
git clone https://github.com/gunchu/nikhil-theme
git clone https://github.com/wilbur-ma/niu-x2
git clone https://github.com/duilio/pelican-octopress-theme
git clone https://github.com/Parbhat/pelican-blue
git clone https://github.com/hdra/pelican-cait
git clone https://github.com/laughk/pelican-hss
git clone https://github.com/wrl/pelican-mockingbird
git clone https://github.com/fle/pelican-simplegrey
git clone https://github.com/fle/pelican-sober
git clone https://github.com/ingwinlu/pelican-twitchy
git clone https://github.com/badele/pelicanthemes-generator
git clone https://github.com/jjimenezlopez/pelipress
git clone https://github.com/xm3ron/pjport
git clone https://github.com/kdeldycke/plumage
git clone https://github.com/habibillah/pujangga
git clone https://github.com/danclaudiupop/pure
git clone https://github.com/wamonite/relapse
git clone https://github.com/ellisonleao/pelican-semantic-ui
git clone https://github.com/kdheepak89/pelican-smoothie
git clone https://github.com/if1live/pelican-sora
git clone https://github.com/redVi/storm
git clone https://github.com/keningle/pelican-sundown
git clone https://github.com/giulivo/pelican-svbhack
git clone https://github.com/wting/pelican-svbtle
git clone https://github.com/frankV/twenty-pelican-html5up
git clone https://github.com/robulouski/voidy-bootstrap
git clone https://github.com/samael500/w3-personal-blog
git clone https://github.com/jarv/water-iris
git clone https://github.com/kplaube/yapeme
2016-09-10 20:23:49 +02:00
}
2016-10-16 13:51:04 +02:00
function mesh_install_pelican {
2016-09-10 20:23:49 +02:00
if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
return
fi
2016-10-23 20:38:14 +02:00
chroot "$rootdir" apt-get -yq install python-pip
2016-09-10 20:23:49 +02:00
chroot "$rootdir" pip install ipython
chroot "$rootdir" pip install Markdown
chroot "$rootdir" pip install typogrify
chroot "$rootdir" pip install pelican
STATIC_BLOG_INSTALL_DIR=/home/$MY_USERNAME/CreateBlog
STATIC_BLOG_PATH=/home/$MY_USERNAME/Public/Blog
if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR ]; then
mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR
fi
if [ ! -d $rootdir$STATIC_BLOG_PATH ]; then
mkdir -p $rootdir$STATIC_BLOG_PATH
fi
if [ ! -d $rootdir$STATIC_BLOG_INSTALL_DIR/content/images ]; then
mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/content/images
fi
create_pelican_conf $rootdir$STATIC_BLOG_INSTALL_DIR/pelicanconf.py
create_pelican_makefile $rootdir$STATIC_BLOG_INSTALL_DIR/Makefile
create_pelican_publish_conf $rootdir$STATIC_BLOG_INSTALL_DIR/publishconf.py
mkdir -p $rootdir$STATIC_BLOG_INSTALL_DIR/themes
cd $rootdir$STATIC_BLOG_INSTALL_DIR/themes
2016-10-16 13:51:04 +02:00
pelican_themes
2016-09-10 19:43:08 +02:00
#git clone --recursive $PELICAN_PLUGINS_REPO $rootdir$STATIC_BLOG_INSTALL_DIR/plugins
2016-09-07 21:44:32 +02:00
chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME $STATIC_BLOG_INSTALL_DIR
2016-09-08 10:35:53 +02:00
chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Public
2016-09-07 21:44:32 +02:00
}
2016-10-16 13:51:04 +02:00
function install_pelican {
2016-09-07 21:44:32 +02:00
if [ $INSTALLING_MESH ]; then
2016-10-16 13:51:04 +02:00
mesh_install_pelican
2016-09-07 21:44:32 +02:00
return
fi
2016-10-23 20:38:14 +02:00
apt-get -yq install python-pip
2016-09-07 21:44:32 +02:00
pip install ipython
pip install Markdown
pip install typogrify
pip install pelican
2016-09-08 10:35:53 +02:00
STATIC_BLOG_INSTALL_DIR=/etc/blog
2017-03-25 19:07:31 +01:00
STATIC_BLOG_PATH=/var/www/$PELICAN_BLOG_DOMAIN/htdocs
2016-09-08 10:35:53 +02:00
2016-09-07 21:44:32 +02:00
if [ ! -d $STATIC_BLOG_INSTALL_DIR ]; then
mkdir -p $STATIC_BLOG_INSTALL_DIR
fi
if [ ! -d $STATIC_BLOG_PATH ]; then
mkdir -p $STATIC_BLOG_PATH
fi
2016-09-08 10:35:53 +02:00
if [ ! -d $STATIC_BLOG_INSTALL_DIR/content ]; then
mkdir -p $STATIC_BLOG_INSTALL_DIR/content
fi
2016-09-07 21:44:32 +02:00
2016-09-08 10:35:53 +02:00
create_pelican_conf $STATIC_BLOG_INSTALL_DIR/pelicanconf.py
create_pelican_makefile $STATIC_BLOG_INSTALL_DIR/Makefile
create_pelican_publish_conf $STATIC_BLOG_INSTALL_DIR/publishconf.py
2016-09-07 21:44:32 +02:00
2016-09-10 20:23:49 +02:00
mkdir -p $PELICAN_THEMES_REPO $STATIC_BLOG_INSTALL_DIR/themes
cd $PELICAN_THEMES_REPO $STATIC_BLOG_INSTALL_DIR/themes
2016-10-16 13:51:04 +02:00
pelican_themes
2016-09-10 20:23:49 +02:00
#git clone --recursive $PELICAN_PLUGINS_REPO $STATIC_BLOG_INSTALL_DIR/plugins
2016-09-07 21:44:32 +02:00
chown -R $MY_USERNAME:$MY_USERNAME $STATIC_BLOG_INSTALL_DIR
2016-09-08 10:35:53 +02:00
chown -R www-data:www-data $STATIC_BLOG_PATH
APP_INSTALLED=1
2016-09-07 21:44:32 +02:00
}
# NOTE: deliberately no exit 0