#!/bin/sh -e title='rgz.ee' url='https://rgz.ee' dst="/var/www/htdocs/$(basename "$PWD" '.git')" raw="$dst/raw" src="$dst/src" rm -rf "${dst:?}/.files" rm -rf "${raw:?}" rm -rf "${src:?}" if test -z "${PWD##*.git}" then repo="$PWD" else repo="$PWD/.git" fi echo "${title}" > "$repo/owner" echo "${url##*//}" > "$repo/description" echo "${url}/raw/.git" > "$repo/url" git clone "$repo" "$raw" (cd "$raw/.git" && git update-server-info) "$HOME/bin/ssg6" "$raw" "$dst" "$title" "$url" > /dev/null "$HOME/bin/rssg" "$raw/n/index.md" "Newsletter - $title" > "$dst/n/rss.xml" mkdir -p "$src" (cd "$src" && stagit "$repo") cp -f "$src/log.html" "$src/index.html" cp -f "$raw/stagit/"* "$src/" >&2 echo "[stagit] $(grep -c '"commit' "$src/log.html") commits" hostname > "$dst/hostname"