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 6733942e0bef0be48959a6a4bdb7825971d5a4e4
parent 9fb760107489a64980ca51dd7c439b1f121bcfe2
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun, 28 Apr 2024 22:33:04 +0200

add option to configure server URL

Diffstat:
M.htaccess | 6++++--
MREADME | 4++++
Mbin/git_create_repo.sh | 13+++++++------
Mbin/git_export_tarball.sh | 11+++++++++--
4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/.htaccess b/.htaccess @@ -10,9 +10,11 @@ Options -Indexes # Disallow browsing of certain sub-directories (redirect to 404) RedirectMatch 404 ^/.git/.*$ +RedirectMatch 404 ^/.ssh/.*$ +RedirectMatch 404 ^/.config/.*$ +RedirectMatch 404 ^/.cache/.*$ RedirectMatch 404 ^/bin/.*$ -RedirectMatch 404 ^/templates/.*$ -#RedirectMatch 404 ^/.*?\.git/.*$ +RedirectMatch 404 ^/.url$ # Style filebrowser IndexStyleSheet /assets/index.css diff --git a/README b/README @@ -76,6 +76,10 @@ to set up a user/password for the web-access, e.g. here for the user "username": Optional Tweaks --------------- +Set your stagit server's URL via the "url" file: + + echo "https://src.example.com" > /var/www/src.example.com/url + You may also setup SSH-credentials for the user or SSH-Auth keys. You most likely want to setup a webserver (e.g. Apache2) with "/var/www/ diff --git a/bin/git_create_repo.sh b/bin/git_create_repo.sh @@ -7,18 +7,16 @@ # $3 - repo name # $4 - description # $5 - owner/maintainer -# $6 - prot + domain: https://git.example.com # Error out if not all options are given -if [ -z "$6" ]; then +if [ -z "$5" ]; then echo "Usage: git_create_repo.sh \\ \"/var/www/git.example.git\" \\ \"pub\" \\ \"stagit-jayvii.de\" \\ \"An example repository.\" \\ - \"JayVii\" \\ - \"https://git.example.com\" + \"JayVii\" " exit 1; fi @@ -46,8 +44,11 @@ echo "$4" > description # Add owner echo "$5" > owner -# Add Clone URL -printf "${6}/${2}/${3}.git" > "${1}/${2}/${3}.git/url" +# Add Clone URL, if "url" file exists in root directory +if [ -f "${1}/url" ]; then + URL=`cat ${1}/url` + echo "${URL}/${2}/${3}.git" > "${1}/${2}/${3}.git/url" +fi # Add Hooks PUH_FILE="${1}/${2}/${3}.git/hooks/post-update" diff --git a/bin/git_export_tarball.sh b/bin/git_export_tarball.sh @@ -21,11 +21,18 @@ fi cd "${1}/${2}/${3}.git" || exit 1; # Get current branch name -BRANCH=`git branch --show-current || echo "current"` +BRANCH=`git branch --show-current || echo "HEAD"` + +# Retrieve URL if set +if [ -f "${1}/url" ]; then + URL=`cat ${1}/url` +else + URL="" +fi # Create tarball and sha256. place them in the export-directory git archive --format=tar.gz -o "${BRANCH}.tar.gz" ${BRANCH} && sha256sum "${BRANCH}.tar.gz" > "${1}/${2}/${3}/exports/${BRANCH}.tar.gz.sha256" && mv "${BRANCH}.tar.gz" "${1}/${2}/${3}/exports/${BRANCH}.tar.gz" && -echo "Archive can be retrieved from ${2}/${3}/exports/${BRANCH}.tar.gz" +echo "Archive can be retrieved from ${URL}/${2}/${3}/exports/${BRANCH}.tar.gz"