From 41bec9f25f2ed6b77a9ac8c18002f8eaa2e9a79b Mon Sep 17 00:00:00 2001 From: Matt Perzel Date: Sat, 22 May 2010 17:27:23 -0700 Subject: [PATCH 1/3] Added host_nickname parameter to gl-easy-install --- src/gl-easy-install | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/gl-easy-install b/src/gl-easy-install index fdb8776..55d08ff 100755 --- a/src/gl-easy-install +++ b/src/gl-easy-install @@ -103,12 +103,15 @@ Usage: $0 [-q] user host [port] admin_name # install - "admin_name" is *your* name as it should appear in the eventual gitolite config file. For upgrades (ie., gitolite is already installed on the server), this argument is not needed, and will be *ignored* if provided. + - "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; optional, defaults to gitolite -Example usage: $0 git my.git.server sitaram +Example usage: $0 git my.git.server sitaram gitolite_server_1 Notes: - - "user" and "admin_name" must be simple names -- no special characters etc - please (only alphanumerics, dot, hyphen, underscore) + - "user","admin_name" and "host_nickname" must be simple names -- no special + characters etc please (only alphanumerics, dot, hyphen, underscore) - 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 gitolite admin @@ -152,20 +155,33 @@ basic_sanity() { host=$2 port=22 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 # the admin_name if echo $3 | perl -lne 'exit 1 unless /^[0-9]+$/' then port=$3 admin_name=$4 + host_nickname=$5 + if [ -z $5 ] + then + host_nickname=gitolite + fi fi echo $user | perl -lne 'exit 1 if /[^a-zA-Z0-9._-]/' || die "user '$user' invalid" [[ "$user" == "root" ]] && die I refuse to install to root 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. # The following files should all be visible: @@ -255,13 +271,14 @@ setup_local_ssh() { # port 22 # identityfile ~/.ssh/sitaram - echo "host gitolite + + echo "host $host_nickname user $user hostname $host port $port 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 prompt "found gitolite para in ~/.ssh/config; assuming it is correct..." "$v_found_para" else @@ -569,7 +586,11 @@ done! IMPORTANT NOTE -- PLEASE READ!!! *Your* URL for cloning any repo on 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 \$user@\$host:reponame.git From c013dbf8f0cc45d7915b528a303ac2b20e04d5ef Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 23 May 2010 09:07:48 +0530 Subject: [PATCH 2/3] (minor fixups) --- src/gl-easy-install | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gl-easy-install b/src/gl-easy-install index 55d08ff..3100f18 100755 --- a/src/gl-easy-install +++ b/src/gl-easy-install @@ -103,15 +103,17 @@ Usage: $0 [-q] user host [port] admin_name # install - "admin_name" is *your* name as it should appear in the eventual gitolite config file. For upgrades (ie., gitolite is already installed on the server), this argument is not needed, and will be *ignored* if provided. - - "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; optional, defaults to gitolite -Example usage: $0 git my.git.server sitaram gitolite_server_1 + - (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: - - "user","admin_name" and "host_nickname" must be simple names -- no special - characters etc please (only alphanumerics, dot, hyphen, underscore) + - "user","admin_name" and "host_nickname" must be simple names -- no + special characters etc please (only alphanumerics, dot, hyphen, + underscore) - 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 gitolite admin @@ -178,10 +180,10 @@ basic_sanity() { die "user '$user' invalid" [[ "$user" == "root" ]] && die I refuse to install to root 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. # The following files should all be visible: @@ -271,7 +273,6 @@ setup_local_ssh() { # port 22 # identityfile ~/.ssh/sitaram - echo "host $host_nickname user $user hostname $host @@ -586,10 +587,10 @@ done! IMPORTANT NOTE -- PLEASE READ!!! *Your* URL for cloning any repo on this server will be - \$host_nickname: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\" + setup, please use that host nickname instead of \"gitolite\" above. *Other* users you set up will have to use From f4d21db590560af11ece24de0599d821343a6916 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 23 May 2010 09:11:30 +0530 Subject: [PATCH 3/3] easy install: clone even if a non-default host_nickname is used --- src/gl-easy-install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gl-easy-install b/src/gl-easy-install index 3100f18..e8fd294 100755 --- a/src/gl-easy-install +++ b/src/gl-easy-install @@ -450,12 +450,12 @@ clone_it() { cleanup cd "$HOME" - if [[ -d gitolite-admin ]] + if [[ -d $host_nickname-admin ]] then - echo $HOME/gitolite-admin exists, skipping clone step... + echo $HOME/$host_nickname-admin exists, skipping clone step... else - prompt "cloning gitolite-admin repo..." "$v_cloning" - git clone gitolite:gitolite-admin + prompt "cloning $host_nickname-admin repo..." "$v_cloning" + git clone $host_nickname:gitolite-admin $host_nickname-admin fi # MANUAL: be sure to read the message below; this applies to you too...