aboutsummaryrefslogtreecommitdiffstats
path: root/roles/git/files/git-shell-commands/make-private
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-04-18 16:41:27 +0800
committerAaron LI <aly@aaronly.me>2018-04-18 16:44:09 +0800
commit053cd1b7fe10f746792e0d1353fad4ad04e8ebe9 (patch)
tree93137af7af0b073383e0db5ae91cbe301f9bcdd1 /roles/git/files/git-shell-commands/make-private
parentf448bcbdf07cf988ab50950df95d822f359041db (diff)
downloadansible-dfly-vps-053cd1b7fe10f746792e0d1353fad4ad04e8ebe9.tar.bz2
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 ^_^
Diffstat (limited to 'roles/git/files/git-shell-commands/make-private')
-rw-r--r--roles/git/files/git-shell-commands/make-private30
1 files changed, 30 insertions, 0 deletions
diff --git a/roles/git/files/git-shell-commands/make-private b/roles/git/files/git-shell-commands/make-private
new file mode 100644
index 0000000..432d847
--- /dev/null
+++ b/roles/git/files/git-shell-commands/make-private
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Copyright (c) 2017 Aaron LI <aly@aaronly.me>
+# MIT License
+#
+# Turn a public Git repository to be private to `cgit`.
+#
+# 2017-06-19
+#
+
+. ${HOME}/vars.conf
+
+if [ $# -ne 1 ]; then
+ echo "usage: make-private <repository.git>"
+ exit 1
+fi
+
+project="${1%.[gG][iI][tT]}.git"
+
+if [ ! -d "${project}" ]; then
+ echo "ERROR: repository '${project}' not exists!"
+ exit 2
+elif [ -L "${PUBLIC}/${project}" ]; then
+ rm "${PUBLIC}/${project}"
+ echo "Made repository '${project}' private."
+ exit 0
+else
+ echo "Repository '${project}' not public."
+ exit 0
+fi