#!/bin/bash set -e # global pd=/usr/bin/pandoc g=/bin/grep tr=/usr/bin/tr sed=/bin/sed sort=/usr/bin/sort postDir=/home/vilmibm/blog/posts htmlDir=/home/vilmibm/public_html/blog htmlIndexTmpl=/home/vilmibm/blog/index.tmpl.html htmlIndex=/home/vilmibm/public_html/blog/index.html gopherPath=/home/vilmibm/public_gopher/blog gopherIndex="${gopherPath}/gophermap" geminiPath=/home/vilmibm/public_gemini/blog geminiIndex="${geminiPath}/index.gmi" cd $postDir > /dev/null # backup HTML index if [ -e "${htmlIndex}" ] then cp $htmlIndex "${htmlIndex}.bak" fi cp $htmlIndexTmpl $htmlIndex # Remove old gopher posts rm ${gopherPath}/* # Initialize blog gophermap echo "!the phlog of vilmibm as it were" > $gopherIndex echo >> $gopherIndex # Initialize blog index for gemini echo "the gemblog of vilmibm as it were" > $geminiIndex echo >> $geminiIndex for p in $(ls *.md | $sort -r) do pubdate=$($g "pubdate:" $p | $sed 's/pubdate: //') title=$($g "title:" $p | $sed 's/title: //') slug=$($g "slug:" $p | $sed 's/slug: //' | $tr -d \[:blank:\]) if [ -z "$pubdate" ] || [ -z "$title" ] || [ -z "$slug" ] then echo "warning: missing at least one of: pubdate, slug, title in ${p}" else # HTML echo "