From: Christian Heller Date: Fri, 3 Apr 2020 22:06:29 +0000 (+0200) Subject: Add dump blog (without uwsgi part). X-Git-Url: https://plomlompom.com/repos/bar%20baz.html?a=commitdiff_plain;h=2b3f10c33b5b8c5f2ff7a71e6b5dcff923f2f960;p=config Add dump blog (without uwsgi part). --- diff --git a/buster/apt-mark/dumpsite b/buster/apt-mark/dumpsite index cd1cd37..403aefb 100644 --- a/buster/apt-mark/dumpsite +++ b/buster/apt-mark/dumpsite @@ -1,3 +1,8 @@ pwgen wget +# for blog and zettel pandoc +# for blog +html2text +uuid-runtime +python3 diff --git a/buster/other_files/blog_hook_post-receive b/buster/other_files/blog_hook_post-receive new file mode 100755 index 0000000..b671248 --- /dev/null +++ b/buster/other_files/blog_hook_post-receive @@ -0,0 +1,17 @@ +#!/bin/sh +blog_dir=~/blog +export GIT_DIR=$(pwd) +export GIT_WORK_TREE="$blog_dir" +git checkout -f +cd "$GIT_WORK_TREE" +redo +git add metadata/author metadata/url metadata/title metadata/*.tmpl metadata/automatic_metadata captchas/linkable/* +count=$(ls -1 metadata/*.automatic_metadata 2>/dev/null | wc -l) +if [ "$count" != 0 ]; then + git add metadata/*.automatic_metadata +fi +status=$(git status -s) +n_updates=$(printf "$status" | grep -vE '^\?\?' | wc -l) +if [ "$n_updates" -gt 0 ]; then + git commit -a -m 'Update metadata' +fi diff --git a/buster/setup_scripts/setup_dumpsite.sh b/buster/setup_scripts/setup_dumpsite.sh index c2ed7cd..923072c 100755 --- a/buster/setup_scripts/setup_dumpsite.sh +++ b/buster/setup_scripts/setup_dumpsite.sh @@ -33,17 +33,32 @@ password_geheim=$(pwgen -1) echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim echo "geheim password is: ${password_geheim}" -# Set up zettel and redo. +# Set up redo. wget http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz tar -moxzf redo-sh.tar.gz -C /usr/local + +# Set up connection to old dump server. cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/ chown plom:plom /home/plom/prepare_to_meet_server.sh su -lc "./prepare_to_meet_server.sh ${old_server}" plom -su -lc "cd /var/repos && git clone --mirror ${old_server}:zettel.git" plom +read -p'Hit Enter when you are done.' ignore +rm /home/plom/prepare_to_meet_server.sh + +# Set up zettel. +su -lc "git clone --mirror ${old_server}:zettel.git" plom cp "${config_tree_prefix}/other_files/zettel_hook_post-receive" /home/plom/zettel.git/hooks/ -su -lc "git clone ~/zettel.git" plom +su -lc "git clone ~/zettel.git && cd zettel && redo" plom su -lc "ln -s /home/plom/zettel /var/www-dump/zettel" plom -rm /home/plom/prepare_to_meet_server.sh + +# Set up redo blog. +su -lc "git clone --mirror ${old_server}:blog.git" plom +cp "${config_tree_prefix}/other_files/blog_hook_post-receive" /home/plom/blog.git/hooks/ +su -lc "git clone ~/blog.git" plom +# FIXME: we should not depend on a GitHub repo +su -lc "git clone https://github.com/plomlompom/redo-blog.git" plom +su -lc "cd redo-blog && ./add_dir.sh ~/blog" plom +su -lc "cd blog && redo" plom +su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom # Prepare NGINX. sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/dumpsite.nginx