pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 43258f079ae577337b3cbf7c8b3cf5550bce51c6
parent 3ed7f0abb61fb24c58c5fbcf2d840e7dd93b79af
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri, 31 Dec 2021 09:20:25 +0000

absolute_git

Diffstat:
Aentry/absolute_git.draft | 47+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+), 0 deletions(-)

diff --git a/entry/absolute_git.draft b/entry/absolute_git.draft @@ -0,0 +1,47 @@ +Recently I migrated from [gitweb]() to [stagit](https://codemadness.org/stagit.html) for my [personal git](https://git.pyratebeard.net) server webpage. I liked gitweb and used it for a number of years, but after seeing some other stagit git sites I preferred the style and decided it was time for a change. + +My git server is using [git-daemon]() to expose the repos. This is really easy to set up following the [official docs](). + +Stagit doesn't take much to get working either. The [README]() is very detailed. To get started clone the stagit repo then use `make` to build and install. This then gives you the `stagit` command for creating the web content and `stagit-index` for generating the index.html page. + +I use the following script to build my stagit content and the index.html page. +``` +#!/bin/sh + +REPOSDIR="/srv/git" +WWWBASE="/var/www/html" +BASEURL="https://git.pyratebeard.net" + +for repo in "${REPOSDIR}/"*/ ; do + # strip .git suffix + r=$(basename "${repo}") + d=$(basename "${repo}" ".git") + printf "%s... " "${d}" + + sudo mkdir -p "${WWWBASE}/${d}" + cd "${WWWBASE}/${d}" || continue + sudo stagit -c ".cache" -u "${BASEURL}/$d/" "${REPOSDIR}/${r}" + + # symlinks + sudo ln -sf log.html index.html + sudo ln -sf ../style.css style.css + sudo ln -sf ../logo.png logo.png + sudo ln -sf ../favicon.png favicon.png + + # this is a little hack to remove the + # border from icon link + for f in $(find . -type f -name "*.html") ; do + sudo sed -i 's%href=".*/"%href="/"\ style="border:\ 0px;"%' "${f}" + done +done + +sudo stagit-index "${REPOSDIR}/"*/ | sudo tee "${WWWBASE}/index.html" +``` + +In order to make sure stagit is kept up to date I use a git [post-receive]() hook in all my repos which runs the script above (called `stagitdo`) +``` +#!/bin/sh +/usr/local/bin/stagitdo +``` + +This means that everytime I push to one of my git repos my stagit website is updated automatically.