summaryrefslogtreecommitdiff
path: root/usr/src/libpiny/lib/Piny/Repo.pm
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/libpiny/lib/Piny/Repo.pm')
-rw-r--r--usr/src/libpiny/lib/Piny/Repo.pm33
1 files changed, 17 insertions, 16 deletions
diff --git a/usr/src/libpiny/lib/Piny/Repo.pm b/usr/src/libpiny/lib/Piny/Repo.pm
index 0c8de36..8ebb0f4 100644
--- a/usr/src/libpiny/lib/Piny/Repo.pm
+++ b/usr/src/libpiny/lib/Piny/Repo.pm
@@ -383,28 +383,29 @@ sub create {
system( "/usr/sbin/adduser", "--quiet", $ikiuser->name, $group->name ) and die "Could not add ikiwiki user to the repo group!";
$ENV{"GIT_DIR"} = $repo->path;
- system( "/usr/bin/git", "init", "--template=/srv/git-template.git", "--quiet", "--shared" ) and die "Could not initialize git repo!";
- system( "/usr/bin/git", "config", "gitweb.owner", $repo->owner->email->address ) and die "Could not git config gitweb.owner!";
- delete $ENV{"GIT_DIR"};
+ system( "/usr/bin/git", "init", "--template=/srv/git-template.git", "--quiet", "--shared" ) and die "Could not initialize git repo!";
- $repo->description( $description );
+ foreach( "git-daemon-export-ok", "packed-refs" ) {
+ open( TOUCH, ">", $repo->path . "/" . $_ ) or die "Could not touch $_ for repo: $!";
+ close( TOUCH );
+ };
- foreach( "git-daemon-export-ok", "packed-refs" ) {
- open( TOUCH, ">", $repo->path . "/" . $_ ) or die "Could not touch $_ for repo: $!";
- close( TOUCH );
- };
+ foreach( "info", "logs" ) {
+ ( -e $repo->path . "/" . $_ ) or mkdir( $repo->path . "/" . $_ ) or die "Could not mkdir $_ for repo: $!";
+ };
- foreach( "info", "logs" ) {
- ( -e $repo->path . "/" . $_ ) or mkdir( $repo->path . "/" . $_ ) or die "Could not mkdir $_ for repo: $!";
- };
+ foreach( "branches", "description", "HEAD", "info", "logs", "objects", "packed-refs", "refs" ) {
+ system( "/bin/chown", "-R", $user->name . "." . $group->name, $repo->path . "/" . $_ ) and die "Could not change ownership of $_ for repo: $!";
+ };
- foreach( "branches", "description", "HEAD", "info", "logs", "objects", "packed-refs", "refs" ) {
- system( "/bin/chown", "-R", $user->name . "." . $group->name, $repo->path . "/" . $_ ) and die "Could not change ownership of $_ for repo: $!";
- };
+ chown( 0, 0, $repo->path, $repo->path . "/config" ) or die "Could not change ownership of git dir!";
- chown( 0, 0, $repo->path, $repo->path . "/config" ) or die "Could not change ownership of git dir!";
+ system( "/bin/chown", "-R", $ikiuser->name . "." . $ikiuser->name, $repo->path . "/hooks" ) and die "Could not change ownership of git hooks!";
- system( "/bin/chown", "-R", $ikiuser->name . "." . $ikiuser->name, $repo->path . "/hooks" ) and die "Could not change ownership of git hooks!";
+ system( "/usr/bin/git", "config", "gitweb.owner", $repo->owner->email->address ) and die "Could not git config gitweb.owner!";
+ delete $ENV{"GIT_DIR"};
+
+ $repo->description( $description );
open( SETUP, ">", "/etc/ikiwiki/piny/" . $repo->name . ".setup" ) or die "Could not open new ikiwiki setup file: $!";
print SETUP $repo->ikiwiki_setup;