diff --git a/contrib/adc/able b/contrib/adc/able
new file mode 100755
index 0000000..a776a3a
--- /dev/null
+++ b/contrib/adc/able
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# WARNING: USES BASH FEATURES...
+
+. $(dirname $0)/adc.common-functions
+
+get_rights_and_owner gitolite-admin
+[[ -z $perm_write ]] && die "just *what* are you trying to pull, young man?"
+
+op=$1
+shift
+
+locs=
+while [[ -n $1 ]]
+do
+ case $1 in
+ '@all' )
+ locs="$locs $HOME"
+ ;;
+ * )
+ [ -d $loc ] && locs="$locs $GL_REPO_BASE_ABS/$1.git"
+ [ -d $loc ] || echo "ignoring $1..."
+ ;;
+ esac
+ shift
+done
+
+case $op in
+ en|enable )
+ for l in $locs
+ do
+ rm -fv $l/.gitolite.down
+ done
+ ;;
+ dis|disable )
+ [[ -t 0 ]] && printf message:
+ read msg <<<$(cat)
+ for l in $locs
+ do
+ echo $msg > $l/.gitolite.down
+ done
+ ;;
+ * )
+ die "argument 1 must be 'en' or 'dis'"
+ ;;
+esac
diff --git a/contrib/adc/adc.common-functions b/contrib/adc/adc.common-functions
index c67710a..2631ed2 100644
--- a/contrib/adc/adc.common-functions
+++ b/contrib/adc/adc.common-functions
@@ -6,7 +6,7 @@ die() { echo "$@"; exit 1; }
get_rights_and_owner() {
local ans
- ans=$(perl -I$HOME/.gitolite/src -Mgitolite -e 'cli_repo_rights("'$1'")')
+ ans=$(perl -I$GL_BINDIR -Mgitolite -e 'cli_repo_rights("'$1'")')
# set shell variables as needed
owner=${ans#* }
diff --git a/doc/admin-defined-commands.mkd b/doc/admin-defined-commands.mkd
index 969f420..b5e6f77 100644
--- a/doc/admin-defined-commands.mkd
+++ b/doc/admin-defined-commands.mkd
@@ -17,7 +17,8 @@ In this document:
* example uses and sample commands in contrib
* fork
* rmrepo
- * (bonus) restricted admin
+ * enable/disable push access temporarily
+ * (bonus) restricted admin
----
@@ -189,6 +190,44 @@ the user invoking it.
+#### enable/disable push access temporarily
+
+If you want to disable push access to gitolite temporarily (maybe for
+maintenance), anyone with write access to the gitolite-admin repo can do this:
+
+ ssh git@server able dis @all # able dis ==> dis able
+
+To re-enable after the maint work is done:
+
+ ssh git@server able en @all # able en ==> en able
+
+You can also do this for one or more individual repos; in place of `@all`,
+just use a space separated list of reponames (exactly as they would appear in
+the config file). Wildcards are not supported; patches welcome ;-)
+
+**NOTE: This needs a specific secondary update hook**. Creating a secondary
+update hook is described in the sections on "custom hooks" and "hook chaining"
+in doc/2. You need code like this in `update.secondary` (don't forget to
+`chmod +x` the file):
+
+ #!/bin/bash
+
+ for f in $HOME/.gitolite.down $PWD/.gitolite.down
+ do
+ if [ -f $f ]
+ then
+ echo >&2
+ echo '*** ABORT ***' >&2
+ echo >&2
+ cat $f >&2
+ exit 1
+ fi
+ done
+
+ exit 0
+
+
+
#### (bonus) restricted admin
It's rather important to me (and presumably others in the "corporate" world)