home · contact · privacy
Add blog git setup.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 5 Dec 2021 17:43:44 +0000 (18:43 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 5 Dec 2021 17:43:44 +0000 (18:43 +0100)
bullseye/other_files/blog_hook_post-receive [new file with mode: 0755]

diff --git a/bullseye/other_files/blog_hook_post-receive b/bullseye/other_files/blog_hook_post-receive
new file mode 100755 (executable)
index 0000000..b671248
--- /dev/null
@@ -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