aboutsummaryrefslogtreecommitdiff
path: root/sigal.bin
diff options
context:
space:
mode:
Diffstat (limited to 'sigal.bin')
-rwxr-xr-xsigal.bin38
1 files changed, 38 insertions, 0 deletions
diff --git a/sigal.bin b/sigal.bin
new file mode 100755
index 0000000..94782b1
--- /dev/null
+++ b/sigal.bin
@@ -0,0 +1,38 @@
+#!/bin/sh
+# File: /usr/local/bin/sigal.bin
+# Author: bgstack15@gmail.com
+# Startdate: 2021-01-24
+# Title: Run sigal static site generator
+# Purpose: run sigal static site generator for provided path
+# History:
+# Usage:
+# called by regen.cgi, or by hand
+# Dependencies:
+# 60_regen_gallery_sudo
+# gallery.te
+# service account "sigal" with `pip3 install --user sigal`
+# Reverse dependencies:
+# httpd conf
+sigal_home=~sigal
+
+test -z "${GALLERY_ID}" && export GALLERY_ID="${1}"
+test -z "${GALLERY_ID}" && { echo "Pass to this script the gallery_id or directory path to a sigal.conf.py. Aborted." 1>&2 ; exit 1 ; }
+if test -d "${GALLERY_ID}" ;
+then
+ cd "${GALLERY_ID}"
+else
+ if test -e /etc/gallery-cgi.conf ;
+ then
+ . /etc/gallery-cgi.conf
+ else
+ # no gallery_id listing exists.
+ echo "No gallery_id table exists. Aborted." 1>&2 ; exit 1
+ fi
+fi
+if test "${GALLERY_ID}" = "init" ;
+then
+ sudo su sigal -s /bin/bash -c "${sigal_home}/.local/bin/sigal init"
+else
+ eval cd \"\${"${GALLERY_ID}"}\"
+ sudo su sigal -s /bin/bash -c "${sigal_home}/.local/bin/sigal build"
+fi
bgstack15