diff options
author | B Stack <bgstack15@gmail.com> | 2021-02-01 09:07:23 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2021-02-01 09:07:23 -0500 |
commit | a4481dc007ff202882b783ed4b36e03a8b4c1d05 (patch) | |
tree | 0f8b5ccb6ea5e966e8d517b07936479ef49b3516 /sigal.bin | |
download | gallery-a4481dc007ff202882b783ed4b36e03a8b4c1d05.tar.gz gallery-a4481dc007ff202882b783ed4b36e03a8b4c1d05.tar.bz2 gallery-a4481dc007ff202882b783ed4b36e03a8b4c1d05.zip |
initial commit
Diffstat (limited to 'sigal.bin')
-rwxr-xr-x | sigal.bin | 38 |
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 |