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 7c7bb84e777043b7bb6a2a7a5a8c1a1baac92469
parent e7ea5903edc67b983afce89538b79ea1090e20fd
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun, 28 Apr 2024 17:59:17 +0200

Export tarballs of current main branch on every push

Diffstat:
Mbin/git_create_repo.sh | 7++-----
Abin/git_export_tarball.sh | 26++++++++++++++++++++++++++
Mbin/git_post_push.sh | 7++++---
Mbin/git_update_repo.sh | 5-----
4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/bin/git_create_repo.sh b/bin/git_create_repo.sh @@ -26,12 +26,13 @@ fi # Create Folders mkdir -p "${1}/${2}/${3}/" mkdir -p "${1}/${2}/${3}.git/" +mkdir -p "${1}/${2}/${3}.exp/" # Git-Repository cd "${1}/${2}/${3}.git" || exit 1; # create bare branch -git init --bare +git init --bare || exit 1; # Set default branch to "main" echo "ref: refs/heads/main" > HEAD @@ -55,7 +56,3 @@ echo "exec ~/bin/git_post_push.sh \"${1}\" \"${2}\" \"${3}\"" >> "$PUH_FILE" # make branch cloneable via http(s) git update-server-info -if [ $(whoami) != "git" ]; then - chown git:www-data -R "../${3}.git" -fi - diff --git a/bin/git_export_tarball.sh b/bin/git_export_tarball.sh @@ -0,0 +1,26 @@ +#!/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 - priv/pub +# $3 - repo name + +# Error out if not all options are given +if [ -z "$3" ]; then + echo "Usage: +git_export_tarball.sh \\ + \"/var/www/git.example.git\" \\ + \"pub\" \\ + \"stagit-jayvii.de\" + " + exit 1; +fi + +# Git-Repository +cd "${1}/${2}/${3}.git" || exit 1; + +# Create tarball and place it in the export-directory +git archive -0 --format=tar.gz -o "${1}/${2}/${3}.exp/main.tar.gz" main && +echo "Archive can be retrieved from ${2}/${3}.exp/main.tar.gz" + diff --git a/bin/git_post_push.sh b/bin/git_post_push.sh @@ -17,7 +17,8 @@ git_post_push.sh \\ exit 1; fi -$HOME/bin/git_update_repo.sh "${1}" "${2}" "${3}" -$HOME/bin/git_update_repo_html.sh "${1}" "${2}" "${3}" -$HOME/bin/git_update_index_html.sh "${1}" "${2}" +. $HOME/bin/git_update_repo.sh "${1}" "${2}" "${3}" +. $HOME/bin/git_export_tarball.sh "${1}" "${2}" "${3}" +. $HOME/bin/git_update_repo_html.sh "${1}" "${2}" "${3}" +. $HOME/bin/git_update_index_html.sh "${1}" "${2}" diff --git a/bin/git_update_repo.sh b/bin/git_update_repo.sh @@ -23,8 +23,3 @@ cd "${1}/${2}/${3}.git" # make branch cloneable via http(s) git update-server-info -# set correct permissions -if [ $(whoami) != "git" ]; then - chown git:www-data -R "${1}/${2}/${3}.git" -fi -