pile

Not quite a web "stack"; more orderly than a web "heap", hopefully?
git clone https://git.kevinlegouguec.net/pile
Log | Files | Refs

commit fba469114156b480750b1bdea57b0db50e7d4ce4
parent eb6070953668c5f2a645eacb99010a96a43f2b31
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sat, 13 Dec 2025 23:51:58 +0100

Add more scripts

Sure hope any of this works.

Diffstat:
Dgit/.tools.env | 19-------------------
Mgit/README.org | 29++++++++++-------------------
Agit/add-repo.sh | 48++++++++++++++++++++++++++++++++++++++++++++++++
Agit/bootstrap.sh | 28++++++++++++++++++++++++++++
Mgit/post-receive | 13+++++--------
Agit/settings.sample | 6++++++
Agit/tools.env | 23+++++++++++++++++++++++
7 files changed, 120 insertions(+), 46 deletions(-)

diff --git a/git/.tools.env b/git/.tools.env @@ -1,19 +0,0 @@ -# Hey Emacs! -*- shell-script -*- please. - -_toolsdir="${BASH_SOURCE[0]%.env}"/install - -_toolsadd () -{ - # TODO bash≥4.3: local -n - local -r var=$1 - local -r val="${_toolsdir}"/$2 - - local -r old=${!var:-} - - eval "export ${var}=${val}${old:+:${old}}" -} - -_toolsadd PATH bin -_toolsadd LD_LIBRARY_PATH lib64 -_toolsadd LIBRARY_PATH lib64 -_toolsadd CPATH include diff --git a/git/README.org b/git/README.org @@ -2,11 +2,12 @@ - HOME/git (=GITDIR=) - REPO - <bare repo content> - - hooks - - post-receive → GITDIR/.tools/pile/git/post-receive + - description + - (owner; default: GECOS full name) - .tools - - pile - - .tools.env + - pile/git + - tracked: add-repo, bootstrap, post-receive, tools.env + - configuration: settings - WWW/git.DOMAIN (=WWWDIR=) - index.html - <stagit site resources: favicon, logo, style> @@ -15,21 +16,11 @@ - <stagit html content> - <stagit resources: description, owner, url> * tools -** TODO bootstrap -- parameters - - =GITDIR= :: HOME/git - - =WWWDIR= :: WWW/git.DOMAIN -- create - - WWWDIR - - install stagit resources: favicon, logo, style - - GITDIR - - GITDIR/.tools - - GITDIR/.tools.env - - GITDIR/.tools/install - - GITDIR/.tools/pile → <current checkout> +** bootstrap +- create GITDIR/.tools/install - clone & build & install libgit2, stagit -** TODO add repo -- source .tools.env +- install stagit resources in WWWDIR: favicon, logo, style +** add repo - setup WWWDIR/REPO - git init --bare - stagit info: @@ -39,7 +30,7 @@ - hooks/post-receive → GITDIR/.tools/pile/git/post-receive - run post-receive ** post-receive -- source .tools.env +- source tools.env - git push www - cd WWWDIR/REPO - update-server-info diff --git a/git/add-repo.sh b/git/add-repo.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -eu +test "${DEBUG:-}" && set -x + +declare -r SCRIPTS_DIR=$(dirname "$(realpath "$0")") +. "${SCRIPTS_DIR}"/settings + +declare -r REPO_DIR=$(realpath "$1") +declare -r REPO_NAME=$(basename "${REPO_DIR}") + +repo-owner () +{ + test -f "${REPO_DIR}"/owner && { + cat "${REPO_DIR}"/owner + return + } + # Sure hope someone ran 'chfn -f'. + getent passwd ${USER} | cut -d: -f5 | cut -d, -f1 +} + +declare -r REPO_DESCRIPTION="${REPO_DIR}"/description +declare -r REPO_OWNER=$(repo-owner) +declare -r REPO_URL=https://${DOMAIN}/${REPO_NAME} + +test -f "${REPO_DESCRIPTION}" || { + echo >&2 "Missing 'description' 🙅" + exit 1 +} + +( + cd "${WWW_DIR}" + git init --bare "${REPO_NAME}" + + cd "${REPO_NAME}" + ln -s ../*.{css,png} . + ln -s "${REPO_DESCRIPTION}" . + echo "${REPO_OWNER}" > owner + echo "${REPO_URL}" > url +) + +( + cd "${REPO_DIR}" + git remote add www "${WWW_DIR}"/"${REPO_NAME}" + ln -s "${SCRIPTS_DIR}"/post-receive hooks/ + + ./hooks/post-receive +) diff --git a/git/bootstrap.sh b/git/bootstrap.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -eu +test "${DEBUG:-}" && set -x + +declare -r SCRIPTS_DIR=$(dirname "$(realpath "$0")") +. "${SCRIPTS_DIR}"/settings + +mkdir -p "${TOOLS_DIR}"/install "${WWW_DIR}" +cd "${TOOLS_DIR}" + +( + git clone https://github.com/libgit2/libgit2 + mkdir libgit2/build + cd libgit2/build + cmake3 .. + cmake3 --build . + cmake3 --install . --prefix "${TOOLS_DIR}"/install +) + +( + git clone git://git.codemadness.org/stagit + . "${SCRIPTS_DIR}"/tools.env + cd stagit + make + make install PREFIX="${TOOLS_DIR}"/install + cp *.{css,png} "${WWW_DIR}" +) diff --git a/git/post-receive b/git/post-receive @@ -2,20 +2,17 @@ set -eu -wwwdir=$(git remote get-url www) -hooksdir=$(dirname "$(realpath "$0")") -toolsdir=$(dirname "${hooksdir}") -toolsenv=${toolsdir}.env - -. "${toolsenv}" +declare -r SCRIPTS_DIR=$(dirname "$(realpath "$0")") +. "${SCRIPTS_DIR}"/settings +. "${SCRIPTS_DIR}"/tools.env v () {( set -x ; "$@" )} v git push --all --force www -cd "${wwwdir}" +cd "${WWW_DIR}" v git update-server-info -v stagit ${PWD} +v stagit "${PWD}" cd .. # TODO bash≥4.4: readarray -d '' < <(dirname -z */HEAD) diff --git a/git/settings.sample b/git/settings.sample @@ -0,0 +1,6 @@ +# Hey Emacs! -*- shell-script -*- please. + +declare -r GIT_DIR=~/git +declare -r TOOLS_DIR=${GIT_DIR}/.tools +declare -r DOMAIN=git.${USER}.uber.space +declare -r WWW_DIR=/var/www/virtual/${USER}/${DOMAIN} diff --git a/git/tools.env b/git/tools.env @@ -0,0 +1,23 @@ +# Hey Emacs! -*- shell-script -*- please. + +test -d "${TOOLS_DIR}" || { + echo >&2 "TOOLS_DIR unset 🙅" + exit 1 +} + +_toolsadd () +{ + # TODO bash≥4.3: local -n + local -r var=$1 + local -r val=${TOOLS_DIR}/install/$2 + + local -r old=${!var:-} + local -r new=${val}${old:+:${old}} + + eval "export ${var}=${new}" +} + +_toolsadd PATH bin +_toolsadd CPATH include +_toolsadd LIBRARY_PATH lib64 +_toolsadd LD_LIBRARY_PATH lib64