X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv-utils.git;a=blobdiff_plain;f=git-daemon%2Fgit-daemon-service.pl;h=c62c9a2c5d7d70533cf7ebe30bc6c42d5a5aacd1;hp=ec4b7e1516d357590a0e4b908bd330bc36c72675;hb=3b32ef57ecb04c10f67ea6f424cf599aa2d07aef;hpb=18c4999f61d703d687b3c96e419ec9f4d81541fe diff --git a/git-daemon/git-daemon-service.pl b/git-daemon/git-daemon-service.pl index ec4b7e1..c62c9a2 100755 --- a/git-daemon/git-daemon-service.pl +++ b/git-daemon/git-daemon-service.pl @@ -11,28 +11,18 @@ use warnings; use Sys::Syslog; -my $service = $ENV{"USERV_SERVICE"}; -$service =~ s|^git-||; +our $check_repo = 1; +our $check_export = 0; +our ($service,$client,$dir,$repo); -${$cf::{$_}} = $ENV{"USERV_U_$_"} +${$main::{$_}} = $ENV{"USERV_U_$_"} for grep s/^USERV_U_//, keys %ENV; -openlog 'userv-git-daemon/$service', 'pid', 'daemon'; - -sub cf::fail { - syslog 'err', "$cf::client @_"; - exit; -} +openlog 'userv-$service', 'pid', 'daemon'; +sub fail { syslog 'err', "$client @_"; exit } -package cf; - -our $check_repo = 1; -our $check_export = 0; -our ($dir,$repo,$client); $_ = our $uri; -for my $cf (@ARGV) { - do $cf; -} +for my $cf (@ARGV) { do $cf } fail "no repository configured for $uri" unless defined $repo; fail "no directory configured for $uri" unless defined $dir; @@ -47,7 +37,7 @@ fail "bad repository in $uri" fail "repository not exported for $uri" if $check_export and not -e "$dir/git-daemon-export-ok"; -my @cmd = ('git', $service, '--strict', '--timeout=30', $dir); +my @cmd = ($service, '--strict', '--timeout=30', $dir); no warnings; # suppress errors to stderr exec @cmd or fail "exec @cmd: $!";