diff options
-rwxr-xr-x | gitjoe-newrepo.pl | 31 | ||||
-rwxr-xr-x | gitjoe-newuser.pl | 2 |
2 files changed, 32 insertions, 1 deletions
diff --git a/gitjoe-newrepo.pl b/gitjoe-newrepo.pl index dc91e6e..d90993c 100755 --- a/gitjoe-newrepo.pl +++ b/gitjoe-newrepo.pl @@ -16,6 +16,37 @@ sub main { my $usr = $ARGV[0]; my $repo = $ARGV[1]; my $home_dir = '/usr/home/' . $usr . '/'; + if (substr($repo, -4) ne '.git') { + $repo = $repo . '.git'; + } + $repo = $repo . '/'; + system( + '/usr/local/bin/dash', + '-c', + '/bin/mkdir -v ' . $home_dir . $repo + ); + system( + '/usr/local/bin/dash', + '-c', + '/usr/local/bin/git -C ' . $home_dir . $repo . ' init --bare' + ); + system( + '/usr/local/bin/dash', + '-c', + '/usr/sbin/chown -v -R ' . $usr . ':' . $usr . ' ' . $home_dir . $repo + ); + system( + '/usr/local/bin/dash', + '-c', + '/usr/bin/touch -v ' . $home_dir . $repo . 'git-daemon-export-ok' + ); + system( + '/usr/local/bin/dash', + '-c', + '/usr/sbin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . $repo . 'git-daemon-export-ok' + ); + system( + ); exit; } diff --git a/gitjoe-newuser.pl b/gitjoe-newuser.pl index dfc7ad7..bd3c8ca 100755 --- a/gitjoe-newuser.pl +++ b/gitjoe-newuser.pl @@ -56,7 +56,7 @@ EOF" '/bin/chmod -v 700 ' . $home_dir . '.ssh/' ); open(my $fh, '>:encoding(UTF-8)', $home_dir . '.ssh/authorized_keys'); - print $fh "$sshkey\n"; + print $fh $sshkey . "\n"; close($fh); system( '/usr/local/bin/dash', |