"sudo" adc

The sudo adc should make life easier for any admin wishing to run an adc
as some other user.

As a result, the rmrepo adc also goes back to its simple roots.  Now you
just run it via the sudo adc if you (as gitolite admin) needs to rmrepo
some user's repo.
This commit is contained in:
Sitaram Chamarty 2010-10-06 20:32:48 +05:30
parent c40622b302
commit afbab1dd8d
2 changed files with 23 additions and 11 deletions

23
contrib/adc/sudo Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
# this command is pretty cool, even if I may say so myself :)
# for any ADC that a normal user can run, like
# ssh git@server adc arguments
# this adc lets a "super user" (defined as "have write access to the
# gitolite-admin repo"), do this
# ssh git@server sudo normal_user adc arguments
. $(dirname $0)/adc.common-functions
get_rights_and_owner gitolite-admin
[ -z "$perm_write" ] && die "just *what* are you trying to pull, young man?"
user="$1"; shift
cmd="$1"; shift
GL_USER=$user; export GL_USER
exec $(dirname $0)/$cmd "$@"