From 053cd1b7fe10f746792e0d1353fad4ad04e8ebe9 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 18 Apr 2018 16:41:27 +0800 Subject: Add git role: host git repos and share repos via cgit * Host git repositories * Share git repositories through web interface via cgit * The static resources used by cgit is also managed/deployed by a git repo ^_^ --- roles/git/files/git-shell-commands/set-desc | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 roles/git/files/git-shell-commands/set-desc (limited to 'roles/git/files/git-shell-commands/set-desc') diff --git a/roles/git/files/git-shell-commands/set-desc b/roles/git/files/git-shell-commands/set-desc new file mode 100644 index 0000000..3d0a1be --- /dev/null +++ b/roles/git/files/git-shell-commands/set-desc @@ -0,0 +1,31 @@ +#!/bin/sh +# +# ~/git-shell-commands/set-desc +# +# Set the description of an existing Git repository. +# +# Aaron LI +# 2017-08-22 +# + +if [ $# -lt 2 ]; then + echo "Usage: set-desc " + exit 1 +fi + +# Set the project name, adding `.git` extension if missing +project="${1%.[gG][iI][tT]}.git" +shift + +if [ ! -d "${HOME}/${project}" ]; then + echo "ERROR: repository '${project}' not exists!" + exit 2 +fi + +description="$@" +if [ -n "${description}" ]; then + echo "${description}" > ${HOME}/${project}/description +fi + +echo "Set description of Git repository: ${project}" +echo "Description: $(cat ${HOME}/${project}/description)" -- cgit v1.2.2