#!/bin/sh # Make sure the library assets are synchronized: cd assets/library git fetch --all && git reset --hard origin/master cd ../.. # ox-haunt-export sometimes restricts the created post file read permissions to the owner only. # This gets transferred to the remote by Haunt's ssh access, resulting in publish-only read permissions. find ./posts -type f -exec sh -c 'chmod a+r "$0"' {} \; find ./assets/image -type f -exec sh -c 'chmod a+r "$0"' {} \; # Build and publish the HTML site: haunt build && haunt publish # Now convert to Gemini # Uses https://github.com/LukeEmmet/html2gmi # Converts the site into text/gemini; outputs to ./gemini. # There is a publisher which copies that to /home/gemini/gemini/content on the remote. root=$(dirname $0) remotename=functorial.xyz remotedir=/home/gemini/gemini/content shopt -s nullglob rm -rf $root/gemini mkdir $root/gemini $root/gemini/pages $root/gemini/posts $root/gemini/assets $root/gemini/assets/image for page in $root/site/*.html; do out=$root/gemini/$(basename $page ".html").gmi html2gmi --input $page --output $out --emitImagesAsLinks --prettyTables --citationMarkers; sed -i 's/\.html/.gmi/g' $out done for page in $root/site/pages/*.html $root/site/posts/*.html; do out=$root/gemini/$(basename $(dirname $page))/$(basename $page ".html").gmi html2gmi --input $page --output $out --emitImagesAsLinks --prettyTables --citationMarkers; sed -i 's/\.html/.gmi/g' $out done for pic in $root/site/assets/image/*; do cp $pic $root/gemini/assets/image/ done # Copy over relevant site assets to Gemland cp $root/site/assets/cv.pdf $root/gemini/assets/ cp $root/site/assets/pubkey.txt $root/gemini/assets/ cp $root/site/feed.xml $root/gemini/ # Refresh the Gemini site on the server. rsync -r gemini/* root@$remotename:$remotedir ssh root@functorial.xyz "systemctl restart agate" git add . echo 'Commit message: ' read message git commit -m "$message" git push -v origin refs/heads/master\:refs/heads/master