nnscripts

no-nonsense shell script colection for Linux-based environments
git clone git://git.luxferre.top/nnscripts.git
Log | Files | Refs | README | LICENSE

commit 8d462670c6349a95daebeb3d4034cd221b4498b2
parent 9fe16eb055b95a20fa70cdca93383047e525fafd
Author: Luxferre <lux@ferre>
Date:   Fri, 12 Jan 2024 07:39:44 +0200

added set-tepo-owner to ghmd

Diffstat:
Mghmd.sh | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/ghmd.sh b/ghmd.sh @@ -6,7 +6,7 @@ # 4) Git daemon (serving git:// protocol) on the remote instance # 5) access via the Git daemon to individual repositories # 6) repository description and clone URL for some services like stagit -# Usage: ghmd.sh [newsrv | newrepo | gitd-sd | gitd-publish | gitd-unpublish | set-repo-desc | set-repo-url] user@host [name] ("[desc|url]") +# Usage: ghmd.sh [newsrv | newrepo | gitd-sd | gitd-publish | gitd-unpublish | set-repo-desc | set-repo-url | set-repo-owner] user@host [name] ("[desc|url]") # regardless of the actions, the user must have root permissions # prerequisite: git package must be already installed on the server # Created by Luxferre in 2024, released into public domain @@ -49,6 +49,10 @@ Set the (displayed) clone URL of an existing Git repository: $0 set-repo-url root@hostname myrepo git://hostname/myrepo.git +Set the (displayed) owner name of an existing Git repository: + +$0 set-repo-owner root@hostname myrepo "Me, the Author" + Created by Luxferre in 2024, released into public domain EOF } @@ -94,6 +98,16 @@ case "$PARAM" in $SSHCMD "cd $FULLREPODIR;echo \"$VALUE\" > url;chown -R ${GITUSR}:${GITUSR} url" echo "Clone URL set for ${REPODIR}" ;; + "set-repo-owner") # set the repo owner name for some services + [[ -z "$USERHOST" ]] && echo "Error: no user and hostname!" && exit 1 + REPONAME="$3" + [[ -z "$REPONAME" ]] && echo "Error: no repository name!" && exit 1 + VALUE="$4" # it may be empty + REPODIR="${REPONAME}.git" + FULLREPODIR="/home/${GITUSR}/$REPODIR" + $SSHCMD "cd $FULLREPODIR;echo \"$VALUE\" > owner;chown -R ${GITUSR}:${GITUSR} owner" + echo "Owner name set for ${REPODIR}" + ;; "gitd-sd") # set up the Git daemon using a systemd unit [[ -z "$USERHOST" ]] && echo "Error: no user and hostname!" && exit 1 TMPUNIT="/tmp/git-daemon.service"