#!/bin/sh set -e DOC_DIR="$HOME/docs" cd "${DOC_DIR}" || exit 1 # fetch the latest remote repo changes git fetch origin master -q 2> /dev/null # get shas for our local repo and remote repo remotesha=$(git rev-parse origin/master) localsha=$(git rev-parse HEAD) # if shas are different, we need to update if [ "$remotesha" != "$localsha" ] || [ "$1" = "force" ]; then # clear all our local changes git reset --hard HEAD -q # pull in the latest updates from remote git pull -q origin master 2> /dev/null # build the web version /usr/local/bin/mkdocs build > /dev/null 2> /dev/null # clear the gopher version rm /var/gopher/docs/*.md # copy files to the gopher version cd "$HOME/docs/docs/" || exit 1 cp ./*.md /var/gopher/docs/ fi