stagit-scripts

stagit openbsd settings
git clone git://git.nirm.al/stagit-scripts.git
Log | Files | Refs

commit 517a2b60cfa8fbfa9f2180d09c94a4a0baac4f4b
Author: Nirmal Kumar R <tildezero@gmail.com>
Date:   Sat,  4 Jan 2025 02:37:10 +0530

Initial commit

Diffstat:
AGitLabMono.woff2 | 0
Acmd | 6++++++
Aconfig.rc | 6++++++
Alogo.png | 0
Apost-receive | 22++++++++++++++++++++++
Astagit-gen-index | 8++++++++
Astagit-newrepo | 46++++++++++++++++++++++++++++++++++++++++++++++
Astyle.css | 160+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 248 insertions(+), 0 deletions(-)

diff --git a/GitLabMono.woff2 b/GitLabMono.woff2 Binary files differ. diff --git a/cmd b/cmd @@ -0,0 +1,6 @@ +// Create new repo from local machine +ssh rvrgit '/usr/local/bin/stagit-newrepo nirm.al "my website"' + +// On initial creation of repository, run the below command on +// the server to generate the index.html +doas /usr/local/bin/stagit-gen-index diff --git a/config.rc b/config.rc @@ -0,0 +1,6 @@ +GIT_HOME="<git-home>" +WWW_HOME="<www-home>" +CLONE_URI="git://git.nirm.al" +DEFAULT_OWNER="<owner>" +DEFAULT_DESCRIPTION="" +GIT_USER="git" diff --git a/logo.png b/logo.png Binary files differ. diff --git a/post-receive b/post-receive @@ -0,0 +1,22 @@ +#!/bin/sh + +set -euf + +. /var/git/config.rc + +export LC_CTYPE='en_US.UTF-8' +src="$(pwd)" +name=$(basename "$src") +dst="$WWW_HOME/$(basename "$name" '.git')" +mkdir -p "$dst" +#chown -R "$GIT_USER:$GIT_USER" "$dst" +cd "$dst" || exit 1 + +echo "[stagit] building $dst" +/usr/local/bin/stagit "$src" + +echo "[stagit] linking $dst" +ln -sf log.html index.html +ln -sf ../style.css style.css +ln -sf ../logo.png logo.png +ln -sf ../favicon.png favicon.png diff --git a/stagit-gen-index b/stagit-gen-index @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eu + +. /var/git/config.rc + +chown -R git:git "$GIT_HOME"/*.git +/usr/local/bin/stagit-index "$GIT_HOME"/*.git > "$WWW_HOME/index.html" diff --git a/stagit-newrepo b/stagit-newrepo @@ -0,0 +1,46 @@ +#!/bin/sh + +set -eu + +. /var/git/config.rc + +e_log() { + printf '%s\n' "$*" +} + +e_err() { + printf '%s\n' "$*" >&2 +} + +e_exit() { + e_err "$*" + exit 1 +} + +DESC="" +REPO="" + +if [ $# -gt 1 ]; then + DESC="$2" +else + DESC="$DEFAULT_DESCRIPTION" +fi + +if [ $# -eq 0 ]; then + e_exit "not enough args" +else + REPO="$(basename "$1")" +fi + +git init --bare "$GIT_HOME/$REPO.git" +cp "$GIT_HOME/template/post-receive" "$GIT_HOME/$REPO.git/hooks/post-receive" +echo "$CLONE_URI/$REPO.git" > "$GIT_HOME/$REPO.git/url" +echo "$DEFAULT_OWNER" > "$GIT_HOME/$REPO.git/owner" +if [ -n "$DESC" ]; then + echo "$DESC" > "$GIT_HOME/$REPO.git/description" +else + echo "this is a placeholder" > "$GIT_HOME/$REPO.git/description" + fi +chmod u+x "$GIT_HOME/$REPO.git/hooks/post-receive" +mkdir "$WWW_HOME/$REPO" +/usr/local/bin/stagit-gen-index diff --git a/style.css b/style.css @@ -0,0 +1,159 @@ +@font-face { + font-family: '_GitFont'; + src: url('GitLabMono.woff2') format('woff2'); +} + +body { + color: #000; + background-color: #fff; + font-family: '_GitFont', sans-serif; +} + +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: #555; +} + +#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: #eee; +} + +#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: #555; +} + +hr { + border: 0; + border-top: 1px solid #555; + height: 1px; +} + +pre { + font-family: '_GitFont', 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; +} + +@media (prefers-color-scheme: dark) { + body { + background-color: #000; + color: #bdbdbd; + } + hr { + border-color: #222; + } + a { + color: #56c8ff; + } + a:target { + background-color: #222; + } + .desc { + color: #aaa; + } + #blob a { + color: #555; + } + #blob a:target { + color: #eee; + } + #blob a:hover { + color: #56c8ff; + } + pre a.h { + color: #00cdcd; + } + .A, + span.i, + pre a.i { + color: #00cd00; + } + .D, + span.d, + pre a.d { + color: #cd0000; + } + #branches tr:hover td, + #tags tr:hover td, + #index tr:hover td, + #log tr:hover td, + #files tr:hover td { + background-color: #111; + } +} +\ No newline at end of file