pub / stagit-scripts

Building src.jayvii.de with stagit
git clone https://src.jayvii.de/pub/stagit-scripts.git
Home | Log | Files | Exports | Refs | README | RSS

commit f1802398b53e57deb5e18c63bcfe69b5c7037b5a
parent 786d9bfda7de1dc2afbeef7110d26b82ec8fd228
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sat, 27 Apr 2024 20:27:31 +0200

cleanup

Diffstat:
Mbin/git_create_repo.sh | 3++-
Mbin/git_post_push.sh | 12+++++++-----
Dbin/git_set_clone_url.sh | 23-----------------------
Mbin/git_update_index_html.sh | 12+++++++++---
Mbin/git_update_repo.sh | 1-
Mbin/git_update_repo_html.sh | 11++++++++---
6 files changed, 26 insertions(+), 36 deletions(-)

diff --git a/bin/git_create_repo.sh b/bin/git_create_repo.sh @@ -28,7 +28,7 @@ mkdir -p "${1}/${2}/${3}/" mkdir -p "${1}/${2}/${3}.git/" # Git-Repository -cd "${1}/${2}/${3}.git" +cd "${1}/${2}/${3}.git" || exit 1; # create bare branch git init --bare @@ -58,3 +58,4 @@ git update-server-info if [ $(whoami) != "git" ]; then chown git:www-data -R "../${3}.git" fi + diff --git a/bin/git_post_push.sh b/bin/git_post_push.sh @@ -2,6 +2,10 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> +# $1 - HTML Root +# $2 - priv/pub +# $3 - repo name + # Error out if not all options are given if [ -z "$3" ]; then echo "Usage: @@ -13,9 +17,7 @@ git_post_push.sh \\ exit 1; fi +exec $HOME/bin/git_update_repo.sh "${1}" "${2}" "${3}" +exec $HOME/bin/git_update_repo_html.sh "${1}" "${2}" "${3}" +exec $HOME/bin/git_update_index_html.sh "${1}" "${2}" -. $HOME/bin/git_update_repo.sh "${1}" "${2}" "${3}" -sleep 1 -. $HOME/bin/git_update_repo_html.sh "${1}" "${2}" "${3}" -sleep 1 -. $HOME/bin/git_update_index_html.sh "${1}" "${2}" diff --git a/bin/git_set_clone_url.sh b/bin/git_set_clone_url.sh @@ -1,23 +0,0 @@ -#!/usr/bin/env sh -# SPDX-License-Identifier: AGPL-3.0-or-later -# SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> - -# $1 - HTML Root -# $2 - pub/priv -# $3 - repo name -# $4 - prot + domain: https://git.example.com - -# Error out if not all options are given -if [ -z "$4" ]; then - echo "Usage: -git_set_clone_url.sh \\ - \"/var/www/git.example.git\" \\ - \"pub\" \\ - \"stagit-jayvii.de\" \\ - \"https://git.example.com\" - " - exit 1; -fi - - -printf "${4}/${2}/${3}.git" > "${1}/${2}/${3}.git/url" diff --git a/bin/git_update_index_html.sh b/bin/git_update_index_html.sh @@ -15,9 +15,14 @@ git_update_index_html.sh \\ exit 1; fi - -# find respositories -REPOS=$(find "${1}"/"${2}" -maxdepth 1 | grep -E "\.git$" | sed -e 's/\s/\\ /g') +# find respositories, sort them by update time +REPOS=`find "${1}"/"${2}" \ + -maxdepth 1 \ + -type d \ + -name "*.git" \ + -printf "%T+\t%p\n" | \ + sort -r | \ + awk '{print $2}'` # build index HTML stagit-index $REPOS > "${1}/${2}/index.html" @@ -29,3 +34,4 @@ sed -e 's/log\.html/index.html/g' -i "${1}/${2}/index.html" ln -sf "${1}/assets/style.css" "${1}/${2}/style.css" ln -sf "${1}/assets/favicon.png" "${1}/${2}/favicon.png" ln -sf "${1}/assets/favicon.png" "${1}/${2}/logo.png" + diff --git a/bin/git_update_repo.sh b/bin/git_update_repo.sh @@ -17,7 +17,6 @@ git_update_repo.sh \\ exit 1; fi - # Git-Repository cd "${1}/${2}/${3}.git" diff --git a/bin/git_update_repo_html.sh b/bin/git_update_repo_html.sh @@ -18,7 +18,7 @@ git_update_repo_html.sh \\ fi # HTML Viewer -cd "${1}/${2}/${3}" +cd "${1}/${2}/${3}" || exit 1; # Cleanup directory find "${1}/${2}/${3}" -type f -name "*.html" -exec rm {} \; @@ -35,9 +35,14 @@ if [ -z $(find "${1}/${2}/${3}/file" -type f -name "README*.html") ]; then ln -sf "${1}/${2}/${3}/log.html" "${1}/${2}/${3}/index.html" else # use readme as index - find "file/" -type f -name "README*.html" -exec cp {} "index.html" \; + find "${1}/${2}/${3}/file" \ + -type f \ + -name "README*.html" \ + -exec cp {} "${1}/${2}/${3}/index.html" \; # adjust relative paths accordingly - sed -e 's/\.\.\///g' -e 's/href=\"\"/href=\"..\/\"/g' -i "index.html" + sed -e 's/\.\.\///g' \ + -e 's/href=\"\"/href=\"..\/\"/g' \ + -i "${1}/${2}/${3}/index.html" fi # Protect Mail-Adresses in HTML