Merge branch 'add_host_nickname' into pu

Conflicts:
	src/gl-easy-install
This commit is contained in:
Sitaram Chamarty 2010-05-23 09:26:12 +05:30
commit 89655a141c

View file

@ -104,11 +104,16 @@ Usage: $0 [-q] user host [port] admin_name # install
config file. For upgrades (ie., gitolite is already installed on the config file. For upgrades (ie., gitolite is already installed on the
server), this argument is not needed, and will be *ignored* if provided. server), this argument is not needed, and will be *ignored* if provided.
Example usage: $0 git my.git.server sitaram - (optional) "host_nickname" is a nickname that can be given to a particular
installation of gitolite. This allows for multiple servers to easily be
administered from this machine. Defaults to "gitolite"
Example usage: $0 git my.git.server sitaram [gitolite_server_1]
Notes: Notes:
- "user" and "admin_name" must be simple names -- no special characters etc - "user","admin_name" and "host_nickname" must be simple names -- no
please (only alphanumerics, dot, hyphen, underscore) special characters etc please (only alphanumerics, dot, hyphen,
underscore)
- traditionally, the "user" is "git", but it can be anything you want - traditionally, the "user" is "git", but it can be anything you want
- "admin_name" should be your name, for clarity, or whoever will be the - "admin_name" should be your name, for clarity, or whoever will be the
gitolite admin gitolite admin
@ -152,12 +157,23 @@ basic_sanity() {
host=$2 host=$2
port=22 port=22
admin_name=$3 admin_name=$3
host_nickname=$4
if [ -z $4 ]
then
host_nickname="gitolite"
fi
# but if the 3rd arg is a number, that's a port number, and the 4th arg is # but if the 3rd arg is a number, that's a port number, and the 4th arg is
# the admin_name # the admin_name
if echo $3 | perl -lne 'exit 1 unless /^[0-9]+$/' if echo $3 | perl -lne 'exit 1 unless /^[0-9]+$/'
then then
port=$3 port=$3
admin_name=$4 admin_name=$4
host_nickname=$5
if [ -z $5 ]
then
host_nickname=gitolite
fi
fi fi
echo $user | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' || echo $user | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' ||
@ -165,6 +181,8 @@ basic_sanity() {
[[ "$user" == "root" ]] && die I refuse to install to root [[ "$user" == "root" ]] && die I refuse to install to root
echo $admin_name | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' || echo $admin_name | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' ||
die "admin_name '$admin_name' invalid" die "admin_name '$admin_name' invalid"
echo $host_nickname | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' ||
die "host nickname '$host_nickname' invalid"
# MANUAL: make sure you're in the gitolite directory, at the top level. # MANUAL: make sure you're in the gitolite directory, at the top level.
# The following files should all be visible: # The following files should all be visible:
@ -260,13 +278,13 @@ setup_local_ssh() {
# port 22 # port 22
# identityfile ~/.ssh/sitaram # identityfile ~/.ssh/sitaram
echo "host gitolite echo "host $host_nickname
user $user user $user
hostname $host hostname $host
port $port port $port
identityfile ~/.ssh/$admin_name" > $tmpgli/.gl-stanza identityfile ~/.ssh/$admin_name" > $tmpgli/.gl-stanza
if grep 'host *gitolite' "$HOME/.ssh/config" &>/dev/null if grep "host *$host_nickname" "$HOME/.ssh/config" &>/dev/null
then then
prompt "found gitolite para in ~/.ssh/config; assuming it is correct..." "$v_found_para" prompt "found gitolite para in ~/.ssh/config; assuming it is correct..." "$v_found_para"
else else
@ -437,12 +455,12 @@ clone_it()
{ {
cleanup cleanup
cd "$HOME" cd "$HOME"
if [[ -d gitolite-admin ]] if [[ -d $host_nickname-admin ]]
then then
echo $HOME/gitolite-admin exists, skipping clone step... echo $HOME/$host_nickname-admin exists, skipping clone step...
else else
prompt "cloning gitolite-admin repo..." "$v_cloning" prompt "cloning $host_nickname-admin repo..." "$v_cloning"
git clone gitolite:gitolite-admin git clone $host_nickname:gitolite-admin $host_nickname-admin
fi fi
# MANUAL: be sure to read the message below; this applies to you too... # MANUAL: be sure to read the message below; this applies to you too...
@ -574,7 +592,11 @@ done!
IMPORTANT NOTE -- PLEASE READ!!! IMPORTANT NOTE -- PLEASE READ!!!
*Your* URL for cloning any repo from this server will be *Your* URL for cloning any repo from this server will be
gitolite:reponame.git \$host_nickname:reponame.git
Note: If you are upgrading and you set a host nickname during initial
setup, please use that host nickname instead of \"gitolite\"
above.
*Other* users you set up will have to use *Other* users you set up will have to use
\$user@\$host:reponame.git \$user@\$host:reponame.git