summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2022-05-23 14:31:40 +0200
committerPatrick Spek <p.spek@tyil.nl>2022-05-23 14:31:40 +0200
commit59cba4cd51b03c5dacff40bcf43a9c426629fb44 (patch)
tree9d38d193a5a13f39172422568bb095956e01a78d
parenta40c95ec662283dfccac656567a862b1083225a1 (diff)
Add blog sources for use on faiwoo
-rw-r--r--playbooks.d/www-blog/description.txt1
-rw-r--r--playbooks.d/www-blog/etc/defaults2
-rw-r--r--playbooks.d/www-blog/playbook.bash24
3 files changed, 27 insertions, 0 deletions
diff --git a/playbooks.d/www-blog/description.txt b/playbooks.d/www-blog/description.txt
new file mode 100644
index 0000000..c43df4c
--- /dev/null
+++ b/playbooks.d/www-blog/description.txt
@@ -0,0 +1 @@
+Sources for my personal blog
diff --git a/playbooks.d/www-blog/etc/defaults b/playbooks.d/www-blog/etc/defaults
new file mode 100644
index 0000000..5135281
--- /dev/null
+++ b/playbooks.d/www-blog/etc/defaults
@@ -0,0 +1,2 @@
+www.blog.branch=master
+www.blog.path=/var/www/nl.tyil.www
diff --git a/playbooks.d/www-blog/playbook.bash b/playbooks.d/www-blog/playbook.bash
new file mode 100644
index 0000000..e217e73
--- /dev/null
+++ b/playbooks.d/www-blog/playbook.bash
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+playbook_add() {
+ git clone https://git.tyil.nl/blog "$(config www.blog.path)"
+
+ playbook_sync
+}
+
+playbook_sync() {
+ if [[ $BASHTARD_COMMAND != "add" ]]
+ then
+ git -C "$(config www.blog.path)" pull origin "$(config www.blog.branch)"
+ fi
+
+ chgdir "$(config www.blog.path)"
+ hugo -D # This will generate all the draft content
+ hugo # And this will generate the actual live blog, but won't remove the draft content
+}
+
+playbook_del() {
+ rm -fr -- "$(config www.blog.path)"
+
+ pkg uninstall hugo
+}