diff --git a/src/commands/sskm b/src/commands/sskm index eb51f69..3692f37 100755 --- a/src/commands/sskm +++ b/src/commands/sskm @@ -3,6 +3,7 @@ use strict; use warnings; use lib $ENV{GL_LIBDIR}; +use Sys::Hostname; use Gitolite::Rc; use Gitolite::Common; @@ -131,7 +132,7 @@ sub cd_temp_clone { chomp($TEMPDIR); hushed_git( "clone", "$rb/gitolite-admin.git", "$TEMPDIR" ); chdir($TEMPDIR); - my $hostname = `hostname`; chomp($hostname); + my $hostname = hostname(); hushed_git( "config", "--get", "user.email" ) and hushed_git( "config", "user.email", $ENV{USER} . "@" . $hostname ); hushed_git( "config", "--get", "user.name" ) and hushed_git( "config", "user.name", "$ENV{USER} on $hostname" ); } diff --git a/src/lib/Gitolite/Rc.pm b/src/lib/Gitolite/Rc.pm index 41996fb..4e683ac 100644 --- a/src/lib/Gitolite/Rc.pm +++ b/src/lib/Gitolite/Rc.pm @@ -21,6 +21,7 @@ package Gitolite::Rc; ); use Exporter 'import'; +use Sys::Hostname; use Gitolite::Common; @@ -284,7 +285,7 @@ sub version { sub greeting { my $json = shift; - chomp( my $hn = `hostname -s 2>/dev/null || hostname` ); + my $hn = split /\./, hostname(); my $gv = substr( `git --version`, 12 ); my $gl_user = $ENV{GL_USER} || ''; $gl_user = " $gl_user" if $gl_user; diff --git a/src/lib/Gitolite/Setup.pm b/src/lib/Gitolite/Setup.pm index 8ad5d34..77f97ac 100644 --- a/src/lib/Gitolite/Setup.pm +++ b/src/lib/Gitolite/Setup.pm @@ -43,6 +43,7 @@ Subsequent runs: ); use Exporter 'import'; +use Sys::Hostname; use Gitolite::Rc; use Gitolite::Common; @@ -157,8 +158,8 @@ sub setup_gladmin { _chdir("$rc{GL_REPO_BASE}/gitolite-admin.git"); _system("git add conf/gitolite.conf"); _system("git add keydir") if $pubkey; - tsh_try("git config --get user.email") or tsh_run( "git config user.email $ENV{USER}\@" . `hostname` ); - tsh_try("git config --get user.name") or tsh_run( "git config user.name '$ENV{USER} on '" . `hostname` ); + tsh_try("git config --get user.email") or tsh_run( "git config user.email $ENV{USER}\@" . hostname() ); + tsh_try("git config --get user.name") or tsh_run( "git config user.name '$ENV{USER} on '" . hostname() ); tsh_try("git diff --cached --quiet") or tsh_try("git commit -am '$message'") or _die "setup failed to commit to the admin repo";