commit 895f5cd0427aaa869cd17fbff62ce21fccb7b823 (patch)
parent 4202a5c1cf8b9bc3229fd49fd786c7d0e4c32898
Author: Alex Karle <alex@alexkarle.com>
Date: Sun, 12 Jul 2020 21:39:20 -0400
stagit: Add stagit configuration / scripts
I've spent a good portion of the afternoon tweaking my stagit setup,
mostly to provide some automation for when I add a new repo to the
exported repos. It seems natural to put the configs here in the website
repo, as that's where they are hosted / linked from.
Diffstat:
5 files changed, 154 insertions(+), 1 deletion(-)
diff --git a/TODO b/TODO
@@ -10,5 +10,4 @@ Blog Topics
Technical
---------
* Move to markdown-based posts?
-* Add stagit git.alexkarle.com
* Pick short domain name
diff --git a/stagit/logo.png b/stagit/logo.png
Binary files differ.
diff --git a/stagit/post-receive b/stagit/post-receive
@@ -0,0 +1,10 @@
+#!/bin/sh
+# based off of: https://rgz.ee/stagit.html
+set -e
+dst="/var/www/htdocs/git/$(basename "$(pwd)" '.git')"
+src="$(pwd)"
+
+# KEY: run in background (saves a slow push)
+mkdir -p "$dst"
+(cd "$dst" && stagit "$src")
+cp -f "$dst/log.html" "$dst/index.html"
diff --git a/stagit/setup.sh b/stagit/setup.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# setup.sh -- setup repos in $HOME and index for stagit
+# meant to be run as the git user, requires stagit installed
+
+SCRIPTDIR="$(dirname "$(readlink -f "$0")")"
+
+# First setup the dest
+DEST=/var/www/htdocs/git
+cp "$SCRIPTDIR/style.css" "$DEST"
+cp "$SCRIPTDIR/logo.png" "$DEST"
+cp "$SCRIPTDIR/logo.png" "$DEST/favicon.png"
+
+cd $HOME
+for d in *.git; do
+ if [ -e "$d/git-daemon-export-ok" ]; then
+ echo "Processing $d"
+
+ # Setup src
+ cp "$SCRIPTDIR/post-receive" "$d/hooks"
+ echo "Alex Karle" > "$d/owner"
+ echo "git://git.alexkarle.com/$d" > "$d/url"
+
+ # Setup dst
+ base=`basename $d .git`
+ mkdir -p "$DEST/$base"
+ cp "$SCRIPTDIR/style.css" "$DEST/$base"
+ cp "$SCRIPTDIR/logo.png" "$DEST/$base"
+ cp "$SCRIPTDIR/logo.png" "$DEST/$base/favicon.png"
+ (cd $DEST/$base && stagit $HOME/$d)
+
+ # Add to the list of things to index...
+ exported="$exported $d"
+ fi
+done
+
+stagit-index $exported > $DEST/index.html
diff --git a/stagit/style.css b/stagit/style.css
@@ -0,0 +1,108 @@
+/* style.css -- stagit style.css, almost stock from the stagit
+ * examples (changes marked) */
+body {
+ color: #000;
+ background-color: #f5f5f5; /* ajk: changed to darker */
+ font-family: monospace;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-size: 1em;
+ margin: 0;
+}
+
+img, h1, h2 {
+ vertical-align: middle;
+}
+
+img {
+ border: 0;
+}
+
+a:target {
+ background-color: #ccc;
+}
+
+a.d,
+a.h,
+a.i,
+a.line {
+ text-decoration: none;
+}
+
+#blob a {
+ color: #777;
+}
+
+#blob a:hover {
+ color: blue;
+ text-decoration: none;
+}
+
+table thead td {
+ font-weight: bold;
+}
+
+table td {
+ padding: 0 0.4em;
+}
+
+#content table td {
+ vertical-align: top;
+ white-space: nowrap;
+}
+
+#branches tr:hover td,
+#tags tr:hover td,
+#index tr:hover td,
+#log tr:hover td,
+#files tr:hover td {
+ background-color: #dddddd; /* ajk: changed to darker */
+}
+
+#index tr td:nth-child(2),
+#tags tr td:nth-child(3),
+#branches tr td:nth-child(3),
+#log tr td:nth-child(2) {
+ white-space: normal;
+}
+
+td.num {
+ text-align: right;
+}
+
+.desc {
+ color: #777;
+}
+
+hr {
+ border: 0;
+ border-top: 1px solid #777;
+ height: 1px;
+}
+
+pre {
+ font-family: monospace;
+}
+
+pre a.h {
+ color: #00a;
+}
+
+.A,
+span.i,
+pre a.i {
+ color: #070;
+}
+
+.D,
+span.d,
+pre a.d {
+ color: #e00;
+}
+
+pre a.h:hover,
+pre a.i:hover,
+pre a.d:hover {
+ text-decoration: none;
+}